hikyuu 2.6.5__py3-none-win_amd64.whl → 2.6.7__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 (146) hide show
  1. hikyuu/__init__.py +16 -0
  2. hikyuu/__init__.pyi +484 -474
  3. hikyuu/analysis/__init__.pyi +466 -445
  4. hikyuu/analysis/analysis.pyi +467 -446
  5. hikyuu/core.pyi +468 -447
  6. hikyuu/cpp/boost_date_time-mt.dll +0 -0
  7. hikyuu/cpp/boost_serialization-mt.dll +0 -0
  8. hikyuu/cpp/boost_wserialization-mt.dll +0 -0
  9. hikyuu/cpp/core310.pyd +0 -0
  10. hikyuu/cpp/core310.pyi +1070 -878
  11. hikyuu/cpp/core311.pyd +0 -0
  12. hikyuu/cpp/core311.pyi +1070 -878
  13. hikyuu/cpp/core312.pyd +0 -0
  14. hikyuu/cpp/core312.pyi +1070 -878
  15. hikyuu/cpp/core313.pyd +0 -0
  16. hikyuu/cpp/core313.pyi +1070 -876
  17. hikyuu/cpp/core39.pyd +0 -0
  18. hikyuu/cpp/core39.pyi +1070 -878
  19. hikyuu/cpp/hikyuu.dll +0 -0
  20. hikyuu/cpp/hikyuu.lib +0 -0
  21. hikyuu/cpp/i18n/__init__.py +0 -0
  22. hikyuu/cpp/i18n/zh_CN/__init__.py +0 -0
  23. hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
  24. hikyuu/cpp/sqlite3.dll +0 -0
  25. hikyuu/data/clickhouse_upgrade/__init__.py +1 -0
  26. hikyuu/data/clickhouse_upgrade/createdb.sql +1085 -0
  27. hikyuu/data/common_clickhouse.py +465 -0
  28. hikyuu/data/em_block_to_clickhouse.py +120 -0
  29. hikyuu/data/hku_config_template.py +58 -3
  30. hikyuu/data/pytdx_finance_to_clickhouse.py +107 -0
  31. hikyuu/data/pytdx_to_clickhouse.py +841 -0
  32. hikyuu/data/pytdx_to_mysql.py +4 -4
  33. hikyuu/data/pytdx_weight_to_clickhouse.py +191 -0
  34. hikyuu/data/tdx_to_clickhouse.py +448 -0
  35. hikyuu/data/tdx_to_h5.py +1 -1
  36. hikyuu/data/zh_bond10_to_clickhouse.py +49 -0
  37. hikyuu/draw/__init__.pyi +1 -1
  38. hikyuu/draw/drawplot/bokeh_draw.pyi +479 -471
  39. hikyuu/draw/drawplot/echarts_draw.py +9 -8
  40. hikyuu/draw/drawplot/echarts_draw.pyi +479 -471
  41. hikyuu/draw/drawplot/matplotlib_draw.py +3 -3
  42. hikyuu/draw/drawplot/matplotlib_draw.pyi +479 -471
  43. hikyuu/draw/elder.pyi +6 -6
  44. hikyuu/draw/kaufman.py +1 -1
  45. hikyuu/draw/kaufman.pyi +10 -10
  46. hikyuu/draw/volume.pyi +5 -5
  47. hikyuu/examples/notebook/000-Index.ipynb +1 -1
  48. hikyuu/examples/notebook/001-overview.ipynb +78 -63
  49. hikyuu/examples/notebook/002-HowToGetStock.ipynb +259 -40
  50. hikyuu/examples/notebook/003-HowToGetKDataAndDraw.ipynb +49 -41
  51. hikyuu/examples/notebook/004-IndicatorOverview.ipynb +29 -29
  52. hikyuu/examples/notebook/005-Drawplot.ipynb +66 -37
  53. hikyuu/examples/notebook/006-TradeManager.ipynb +808 -61
  54. hikyuu/examples/notebook/007-SystemDetails.ipynb +23 -23
  55. hikyuu/examples/notebook/009-RealData.ipynb +3 -3
  56. hikyuu/examples/notebook/010-Portfolio.ipynb +761 -122
  57. hikyuu/extend.py +15 -100
  58. hikyuu/extend.pyi +478 -493
  59. hikyuu/fetcher/stock/zh_stock_a_pytdx.py +9 -20
  60. hikyuu/fetcher/stock/zh_stock_a_qmt.py +4 -5
  61. hikyuu/fetcher/stock/zh_stock_a_sina_qq.py +16 -60
  62. hikyuu/flat/Spot.py +96 -200
  63. hikyuu/gui/HikyuuTDX.py +134 -7
  64. hikyuu/gui/data/ImportBlockInfoTask.py +11 -0
  65. hikyuu/gui/data/ImportHistoryFinanceTask.py +15 -1
  66. hikyuu/gui/data/ImportPytdxTimeToH5Task.py +11 -1
  67. hikyuu/gui/data/ImportPytdxToH5Task.py +13 -1
  68. hikyuu/gui/data/ImportPytdxTransToH5Task.py +11 -1
  69. hikyuu/gui/data/ImportTdxToH5Task.py +13 -1
  70. hikyuu/gui/data/ImportWeightToSqliteTask.py +14 -1
  71. hikyuu/gui/data/ImportZhBond10Task.py +11 -0
  72. hikyuu/gui/data/MainWindow.py +210 -135
  73. hikyuu/gui/data/UsePytdxImportToH5Thread.py +45 -26
  74. hikyuu/gui/data/UseTdxImportToH5Thread.py +19 -1
  75. hikyuu/gui/dataserver.py +12 -4
  76. hikyuu/gui/spot_server.py +30 -40
  77. hikyuu/gui/start_qmt.py +20 -3
  78. hikyuu/hub.pyi +6 -6
  79. hikyuu/include/hikyuu/DataType.h +2 -0
  80. hikyuu/include/hikyuu/KQuery.h +22 -28
  81. hikyuu/include/hikyuu/MarketInfo.h +1 -1
  82. hikyuu/include/hikyuu/Stock.h +15 -3
  83. hikyuu/include/hikyuu/StockManager.h +12 -3
  84. hikyuu/include/hikyuu/StockTypeInfo.h +6 -0
  85. hikyuu/include/hikyuu/TransRecord.h +2 -8
  86. hikyuu/include/hikyuu/data_driver/kdata/mysql/KRecordTable.h +1 -0
  87. hikyuu/include/hikyuu/doc.h +4 -0
  88. hikyuu/include/hikyuu/global/GlobalSpotAgent.h +1 -1
  89. hikyuu/include/hikyuu/global/SpotRecord.h +15 -31
  90. hikyuu/include/hikyuu/global/agent/spot_generated.h +48 -232
  91. hikyuu/include/hikyuu/global/schedule/scheduler.h +1 -1
  92. hikyuu/include/hikyuu/indicator/Indicator.h +37 -0
  93. hikyuu/include/hikyuu/lang.h +27 -0
  94. hikyuu/include/hikyuu/plugin/KDataToHdf5Importer.h +9 -1
  95. hikyuu/include/hikyuu/plugin/dataserver.h +26 -1
  96. hikyuu/include/hikyuu/plugin/device.h +2 -1
  97. hikyuu/include/hikyuu/plugin/hkuextra.h +56 -0
  98. hikyuu/include/hikyuu/plugin/interface/DataDriverPluginInterface.h +27 -0
  99. hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -1
  100. hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +1 -1
  101. hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +38 -0
  102. hikyuu/include/hikyuu/plugin/interface/ImportKDataToHdf5PluginInterface.h +13 -1
  103. hikyuu/include/hikyuu/plugin/interface/plugins.h +4 -0
  104. hikyuu/include/hikyuu/python/pybind_utils.h +9 -0
  105. hikyuu/include/hikyuu/strategy/Strategy.h +0 -9
  106. hikyuu/include/hikyuu/trade_manage/TradeRecord.h +1 -1
  107. hikyuu/include/hikyuu/utilities/config.h +0 -2
  108. hikyuu/include/hikyuu/utilities/os.h +9 -0
  109. hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +2 -1
  110. hikyuu/include/hikyuu/version.h +4 -4
  111. hikyuu/include/hikyuu/view/MarketView.h +59 -0
  112. hikyuu/indicator/__init__.py +0 -1
  113. hikyuu/indicator/indicator.py +14 -53
  114. hikyuu/plugin/backtest.dll +0 -0
  115. hikyuu/plugin/clickhousedriver.dll +0 -0
  116. hikyuu/plugin/dataserver.dll +0 -0
  117. hikyuu/plugin/device.dll +0 -0
  118. hikyuu/plugin/extind.dll +0 -0
  119. hikyuu/plugin/hkuextra.dll +0 -0
  120. hikyuu/plugin/import2hdf5.dll +0 -0
  121. hikyuu/plugin/tmreport.dll +0 -0
  122. hikyuu/test/test_init.py +59 -0
  123. hikyuu/test/test_real_tdx_import.py +336 -0
  124. hikyuu/test/test_tdx_import.py +315 -0
  125. hikyuu/test/test_tdx_real_data_import.py +281 -0
  126. hikyuu/trade_manage/__init__.pyi +479 -471
  127. hikyuu/trade_manage/trade.py +4 -65
  128. hikyuu/trade_manage/trade.pyi +479 -483
  129. hikyuu/trade_sys/__init__.py +11 -0
  130. hikyuu/util/__init__.py +1 -0
  131. hikyuu/util/__init__.pyi +4 -4
  132. hikyuu/util/check.py +8 -0
  133. hikyuu/util/check.pyi +5 -1
  134. hikyuu/util/singleton.pyi +1 -1
  135. {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/METADATA +7 -5
  136. {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/RECORD +142 -124
  137. {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/top_level.txt +4 -3
  138. hikyuu/include/hikyuu/global/agent/hikyuu/flat/__init__.py +0 -1
  139. hikyuu/include/hikyuu/utilities/mo/__init__.py +0 -1
  140. hikyuu/include/hikyuu/utilities/mo/mo.h +0 -48
  141. hikyuu/indicator/talib_wrap.py +0 -1273
  142. /hikyuu/include/hikyuu/utilities/{mo/moFileReader.h → moFileReader.h} +0 -0
  143. /hikyuu/include/hikyuu/{global/agent/hikyuu → view}/__init__.py +0 -0
  144. {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/LICENSE +0 -0
  145. {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/WHEEL +0 -0
  146. {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/entry_points.txt +0 -0
@@ -16,37 +16,21 @@ namespace hku {
16
16
  * @ingroup Agent
17
17
  */
18
18
  struct HKU_API SpotRecord {
19
- string market; ///< 市场标识
20
- string code; ///< 证券代码
21
- string name; ///< 证券名称
22
- Datetime datetime; ///< 数据时间
23
- price_t yesterday_close; ///< 昨日收盘价
24
- price_t open; ///< 开盘价
25
- price_t high; ///< 最高价
26
- price_t low; ///< 最低价
27
- price_t close; ///< 收盘价
28
- price_t amount; ///< 成交金额 (千元)
29
- price_t volume; ///< 成交量(手)
30
- price_t bid1; ///< 买一价
31
- price_t bid1_amount; ///< 买一数量(手)
32
- price_t bid2; ///< 买二价
33
- price_t bid2_amount; ///< 买二数量
34
- price_t bid3; ///< 买三价
35
- price_t bid3_amount; ///< 买三数量
36
- price_t bid4; ///< 买四价
37
- price_t bid4_amount; ///< 买四数量
38
- price_t bid5; ///< 买五价
39
- price_t bid5_amount; ///< 买五数量
40
- price_t ask1; ///< 卖一价
41
- price_t ask1_amount; ///< 卖一数量
42
- price_t ask2; ///< 卖二价
43
- price_t ask2_amount; ///< 卖二数量
44
- price_t ask3; ///< 卖三价
45
- price_t ask3_amount; ///< 卖三数量
46
- price_t ask4; ///< 卖四价
47
- price_t ask4_amount; ///< 卖四数量
48
- price_t ask5; ///< 卖五价
49
- price_t ask5_amount; ///< 卖五数量
19
+ string market; ///< 市场标识
20
+ string code; ///< 证券代码
21
+ string name; ///< 证券名称
22
+ Datetime datetime; ///< 数据时间
23
+ price_t yesterday_close; ///< 昨日收盘价
24
+ price_t open; ///< 开盘价
25
+ price_t high; ///< 最高价
26
+ price_t low; ///< 最低价
27
+ price_t close; ///< 收盘价
28
+ price_t amount; ///< 成交金额 (千元)
29
+ price_t volume; ///< 成交量(手)
30
+ vector<double> bid; ///< 委买价
31
+ vector<double> bid_amount; ///< 委买量
32
+ vector<double> ask; ///< 委卖价
33
+ vector<double> ask_amount; ///< 委卖量
50
34
  };
51
35
 
52
36
  } // namespace hku
@@ -36,26 +36,10 @@ struct Spot FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
36
36
  VT_CLOSE = 20,
37
37
  VT_AMOUNT = 22,
38
38
  VT_VOLUME = 24,
39
- VT_BID1 = 26,
40
- VT_BID1_AMOUNT = 28,
41
- VT_BID2 = 30,
42
- VT_BID2_AMOUNT = 32,
43
- VT_BID3 = 34,
44
- VT_BID3_AMOUNT = 36,
45
- VT_BID4 = 38,
46
- VT_BID4_AMOUNT = 40,
47
- VT_BID5 = 42,
48
- VT_BID5_AMOUNT = 44,
49
- VT_ASK1 = 46,
50
- VT_ASK1_AMOUNT = 48,
51
- VT_ASK2 = 50,
52
- VT_ASK2_AMOUNT = 52,
53
- VT_ASK3 = 54,
54
- VT_ASK3_AMOUNT = 56,
55
- VT_ASK4 = 58,
56
- VT_ASK4_AMOUNT = 60,
57
- VT_ASK5 = 62,
58
- VT_ASK5_AMOUNT = 64
39
+ VT_BID = 26,
40
+ VT_BID_AMOUNT = 28,
41
+ VT_ASK = 30,
42
+ VT_ASK_AMOUNT = 32
59
43
  };
60
44
  const ::flatbuffers::String *market() const {
61
45
  return GetPointer<const ::flatbuffers::String *>(VT_MARKET);
@@ -90,65 +74,17 @@ struct Spot FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
90
74
  double volume() const {
91
75
  return GetField<double>(VT_VOLUME, 0.0);
92
76
  }
93
- double bid1() const {
94
- return GetField<double>(VT_BID1, 0.0);
77
+ const ::flatbuffers::Vector<double> *bid() const {
78
+ return GetPointer<const ::flatbuffers::Vector<double> *>(VT_BID);
95
79
  }
96
- double bid1_amount() const {
97
- return GetField<double>(VT_BID1_AMOUNT, 0.0);
80
+ const ::flatbuffers::Vector<double> *bid_amount() const {
81
+ return GetPointer<const ::flatbuffers::Vector<double> *>(VT_BID_AMOUNT);
98
82
  }
99
- double bid2() const {
100
- return GetField<double>(VT_BID2, 0.0);
83
+ const ::flatbuffers::Vector<double> *ask() const {
84
+ return GetPointer<const ::flatbuffers::Vector<double> *>(VT_ASK);
101
85
  }
102
- double bid2_amount() const {
103
- return GetField<double>(VT_BID2_AMOUNT, 0.0);
104
- }
105
- double bid3() const {
106
- return GetField<double>(VT_BID3, 0.0);
107
- }
108
- double bid3_amount() const {
109
- return GetField<double>(VT_BID3_AMOUNT, 0.0);
110
- }
111
- double bid4() const {
112
- return GetField<double>(VT_BID4, 0.0);
113
- }
114
- double bid4_amount() const {
115
- return GetField<double>(VT_BID4_AMOUNT, 0.0);
116
- }
117
- double bid5() const {
118
- return GetField<double>(VT_BID5, 0.0);
119
- }
120
- double bid5_amount() const {
121
- return GetField<double>(VT_BID5_AMOUNT, 0.0);
122
- }
123
- double ask1() const {
124
- return GetField<double>(VT_ASK1, 0.0);
125
- }
126
- double ask1_amount() const {
127
- return GetField<double>(VT_ASK1_AMOUNT, 0.0);
128
- }
129
- double ask2() const {
130
- return GetField<double>(VT_ASK2, 0.0);
131
- }
132
- double ask2_amount() const {
133
- return GetField<double>(VT_ASK2_AMOUNT, 0.0);
134
- }
135
- double ask3() const {
136
- return GetField<double>(VT_ASK3, 0.0);
137
- }
138
- double ask3_amount() const {
139
- return GetField<double>(VT_ASK3_AMOUNT, 0.0);
140
- }
141
- double ask4() const {
142
- return GetField<double>(VT_ASK4, 0.0);
143
- }
144
- double ask4_amount() const {
145
- return GetField<double>(VT_ASK4_AMOUNT, 0.0);
146
- }
147
- double ask5() const {
148
- return GetField<double>(VT_ASK5, 0.0);
149
- }
150
- double ask5_amount() const {
151
- return GetField<double>(VT_ASK5_AMOUNT, 0.0);
86
+ const ::flatbuffers::Vector<double> *ask_amount() const {
87
+ return GetPointer<const ::flatbuffers::Vector<double> *>(VT_ASK_AMOUNT);
152
88
  }
153
89
  bool Verify(::flatbuffers::Verifier &verifier) const {
154
90
  return VerifyTableStart(verifier) &&
@@ -167,26 +103,14 @@ struct Spot FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
167
103
  VerifyField<double>(verifier, VT_CLOSE, 8) &&
168
104
  VerifyField<double>(verifier, VT_AMOUNT, 8) &&
169
105
  VerifyField<double>(verifier, VT_VOLUME, 8) &&
170
- VerifyField<double>(verifier, VT_BID1, 8) &&
171
- VerifyField<double>(verifier, VT_BID1_AMOUNT, 8) &&
172
- VerifyField<double>(verifier, VT_BID2, 8) &&
173
- VerifyField<double>(verifier, VT_BID2_AMOUNT, 8) &&
174
- VerifyField<double>(verifier, VT_BID3, 8) &&
175
- VerifyField<double>(verifier, VT_BID3_AMOUNT, 8) &&
176
- VerifyField<double>(verifier, VT_BID4, 8) &&
177
- VerifyField<double>(verifier, VT_BID4_AMOUNT, 8) &&
178
- VerifyField<double>(verifier, VT_BID5, 8) &&
179
- VerifyField<double>(verifier, VT_BID5_AMOUNT, 8) &&
180
- VerifyField<double>(verifier, VT_ASK1, 8) &&
181
- VerifyField<double>(verifier, VT_ASK1_AMOUNT, 8) &&
182
- VerifyField<double>(verifier, VT_ASK2, 8) &&
183
- VerifyField<double>(verifier, VT_ASK2_AMOUNT, 8) &&
184
- VerifyField<double>(verifier, VT_ASK3, 8) &&
185
- VerifyField<double>(verifier, VT_ASK3_AMOUNT, 8) &&
186
- VerifyField<double>(verifier, VT_ASK4, 8) &&
187
- VerifyField<double>(verifier, VT_ASK4_AMOUNT, 8) &&
188
- VerifyField<double>(verifier, VT_ASK5, 8) &&
189
- VerifyField<double>(verifier, VT_ASK5_AMOUNT, 8) &&
106
+ VerifyOffset(verifier, VT_BID) &&
107
+ verifier.VerifyVector(bid()) &&
108
+ VerifyOffset(verifier, VT_BID_AMOUNT) &&
109
+ verifier.VerifyVector(bid_amount()) &&
110
+ VerifyOffset(verifier, VT_ASK) &&
111
+ verifier.VerifyVector(ask()) &&
112
+ VerifyOffset(verifier, VT_ASK_AMOUNT) &&
113
+ verifier.VerifyVector(ask_amount()) &&
190
114
  verifier.EndTable();
191
115
  }
192
116
  };
@@ -228,65 +152,17 @@ struct SpotBuilder {
228
152
  void add_volume(double volume) {
229
153
  fbb_.AddElement<double>(Spot::VT_VOLUME, volume, 0.0);
230
154
  }
231
- void add_bid1(double bid1) {
232
- fbb_.AddElement<double>(Spot::VT_BID1, bid1, 0.0);
233
- }
234
- void add_bid1_amount(double bid1_amount) {
235
- fbb_.AddElement<double>(Spot::VT_BID1_AMOUNT, bid1_amount, 0.0);
236
- }
237
- void add_bid2(double bid2) {
238
- fbb_.AddElement<double>(Spot::VT_BID2, bid2, 0.0);
239
- }
240
- void add_bid2_amount(double bid2_amount) {
241
- fbb_.AddElement<double>(Spot::VT_BID2_AMOUNT, bid2_amount, 0.0);
242
- }
243
- void add_bid3(double bid3) {
244
- fbb_.AddElement<double>(Spot::VT_BID3, bid3, 0.0);
245
- }
246
- void add_bid3_amount(double bid3_amount) {
247
- fbb_.AddElement<double>(Spot::VT_BID3_AMOUNT, bid3_amount, 0.0);
248
- }
249
- void add_bid4(double bid4) {
250
- fbb_.AddElement<double>(Spot::VT_BID4, bid4, 0.0);
251
- }
252
- void add_bid4_amount(double bid4_amount) {
253
- fbb_.AddElement<double>(Spot::VT_BID4_AMOUNT, bid4_amount, 0.0);
254
- }
255
- void add_bid5(double bid5) {
256
- fbb_.AddElement<double>(Spot::VT_BID5, bid5, 0.0);
257
- }
258
- void add_bid5_amount(double bid5_amount) {
259
- fbb_.AddElement<double>(Spot::VT_BID5_AMOUNT, bid5_amount, 0.0);
260
- }
261
- void add_ask1(double ask1) {
262
- fbb_.AddElement<double>(Spot::VT_ASK1, ask1, 0.0);
263
- }
264
- void add_ask1_amount(double ask1_amount) {
265
- fbb_.AddElement<double>(Spot::VT_ASK1_AMOUNT, ask1_amount, 0.0);
266
- }
267
- void add_ask2(double ask2) {
268
- fbb_.AddElement<double>(Spot::VT_ASK2, ask2, 0.0);
269
- }
270
- void add_ask2_amount(double ask2_amount) {
271
- fbb_.AddElement<double>(Spot::VT_ASK2_AMOUNT, ask2_amount, 0.0);
272
- }
273
- void add_ask3(double ask3) {
274
- fbb_.AddElement<double>(Spot::VT_ASK3, ask3, 0.0);
275
- }
276
- void add_ask3_amount(double ask3_amount) {
277
- fbb_.AddElement<double>(Spot::VT_ASK3_AMOUNT, ask3_amount, 0.0);
278
- }
279
- void add_ask4(double ask4) {
280
- fbb_.AddElement<double>(Spot::VT_ASK4, ask4, 0.0);
155
+ void add_bid(::flatbuffers::Offset<::flatbuffers::Vector<double>> bid) {
156
+ fbb_.AddOffset(Spot::VT_BID, bid);
281
157
  }
282
- void add_ask4_amount(double ask4_amount) {
283
- fbb_.AddElement<double>(Spot::VT_ASK4_AMOUNT, ask4_amount, 0.0);
158
+ void add_bid_amount(::flatbuffers::Offset<::flatbuffers::Vector<double>> bid_amount) {
159
+ fbb_.AddOffset(Spot::VT_BID_AMOUNT, bid_amount);
284
160
  }
285
- void add_ask5(double ask5) {
286
- fbb_.AddElement<double>(Spot::VT_ASK5, ask5, 0.0);
161
+ void add_ask(::flatbuffers::Offset<::flatbuffers::Vector<double>> ask) {
162
+ fbb_.AddOffset(Spot::VT_ASK, ask);
287
163
  }
288
- void add_ask5_amount(double ask5_amount) {
289
- fbb_.AddElement<double>(Spot::VT_ASK5_AMOUNT, ask5_amount, 0.0);
164
+ void add_ask_amount(::flatbuffers::Offset<::flatbuffers::Vector<double>> ask_amount) {
165
+ fbb_.AddOffset(Spot::VT_ASK_AMOUNT, ask_amount);
290
166
  }
291
167
  explicit SpotBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
292
168
  : fbb_(_fbb) {
@@ -312,47 +188,11 @@ inline ::flatbuffers::Offset<Spot> CreateSpot(
312
188
  double close = 0.0,
313
189
  double amount = 0.0,
314
190
  double volume = 0.0,
315
- double bid1 = 0.0,
316
- double bid1_amount = 0.0,
317
- double bid2 = 0.0,
318
- double bid2_amount = 0.0,
319
- double bid3 = 0.0,
320
- double bid3_amount = 0.0,
321
- double bid4 = 0.0,
322
- double bid4_amount = 0.0,
323
- double bid5 = 0.0,
324
- double bid5_amount = 0.0,
325
- double ask1 = 0.0,
326
- double ask1_amount = 0.0,
327
- double ask2 = 0.0,
328
- double ask2_amount = 0.0,
329
- double ask3 = 0.0,
330
- double ask3_amount = 0.0,
331
- double ask4 = 0.0,
332
- double ask4_amount = 0.0,
333
- double ask5 = 0.0,
334
- double ask5_amount = 0.0) {
191
+ ::flatbuffers::Offset<::flatbuffers::Vector<double>> bid = 0,
192
+ ::flatbuffers::Offset<::flatbuffers::Vector<double>> bid_amount = 0,
193
+ ::flatbuffers::Offset<::flatbuffers::Vector<double>> ask = 0,
194
+ ::flatbuffers::Offset<::flatbuffers::Vector<double>> ask_amount = 0) {
335
195
  SpotBuilder builder_(_fbb);
336
- builder_.add_ask5_amount(ask5_amount);
337
- builder_.add_ask5(ask5);
338
- builder_.add_ask4_amount(ask4_amount);
339
- builder_.add_ask4(ask4);
340
- builder_.add_ask3_amount(ask3_amount);
341
- builder_.add_ask3(ask3);
342
- builder_.add_ask2_amount(ask2_amount);
343
- builder_.add_ask2(ask2);
344
- builder_.add_ask1_amount(ask1_amount);
345
- builder_.add_ask1(ask1);
346
- builder_.add_bid5_amount(bid5_amount);
347
- builder_.add_bid5(bid5);
348
- builder_.add_bid4_amount(bid4_amount);
349
- builder_.add_bid4(bid4);
350
- builder_.add_bid3_amount(bid3_amount);
351
- builder_.add_bid3(bid3);
352
- builder_.add_bid2_amount(bid2_amount);
353
- builder_.add_bid2(bid2);
354
- builder_.add_bid1_amount(bid1_amount);
355
- builder_.add_bid1(bid1);
356
196
  builder_.add_volume(volume);
357
197
  builder_.add_amount(amount);
358
198
  builder_.add_close(close);
@@ -360,6 +200,10 @@ inline ::flatbuffers::Offset<Spot> CreateSpot(
360
200
  builder_.add_high(high);
361
201
  builder_.add_open(open);
362
202
  builder_.add_yesterday_close(yesterday_close);
203
+ builder_.add_ask_amount(ask_amount);
204
+ builder_.add_ask(ask);
205
+ builder_.add_bid_amount(bid_amount);
206
+ builder_.add_bid(bid);
363
207
  builder_.add_datetime(datetime);
364
208
  builder_.add_name(name);
365
209
  builder_.add_code(code);
@@ -380,30 +224,18 @@ inline ::flatbuffers::Offset<Spot> CreateSpotDirect(
380
224
  double close = 0.0,
381
225
  double amount = 0.0,
382
226
  double volume = 0.0,
383
- double bid1 = 0.0,
384
- double bid1_amount = 0.0,
385
- double bid2 = 0.0,
386
- double bid2_amount = 0.0,
387
- double bid3 = 0.0,
388
- double bid3_amount = 0.0,
389
- double bid4 = 0.0,
390
- double bid4_amount = 0.0,
391
- double bid5 = 0.0,
392
- double bid5_amount = 0.0,
393
- double ask1 = 0.0,
394
- double ask1_amount = 0.0,
395
- double ask2 = 0.0,
396
- double ask2_amount = 0.0,
397
- double ask3 = 0.0,
398
- double ask3_amount = 0.0,
399
- double ask4 = 0.0,
400
- double ask4_amount = 0.0,
401
- double ask5 = 0.0,
402
- double ask5_amount = 0.0) {
227
+ const std::vector<double> *bid = nullptr,
228
+ const std::vector<double> *bid_amount = nullptr,
229
+ const std::vector<double> *ask = nullptr,
230
+ const std::vector<double> *ask_amount = nullptr) {
403
231
  auto market__ = market ? _fbb.CreateString(market) : 0;
404
232
  auto code__ = code ? _fbb.CreateString(code) : 0;
405
233
  auto name__ = name ? _fbb.CreateString(name) : 0;
406
234
  auto datetime__ = datetime ? _fbb.CreateString(datetime) : 0;
235
+ auto bid__ = bid ? _fbb.CreateVector<double>(*bid) : 0;
236
+ auto bid_amount__ = bid_amount ? _fbb.CreateVector<double>(*bid_amount) : 0;
237
+ auto ask__ = ask ? _fbb.CreateVector<double>(*ask) : 0;
238
+ auto ask_amount__ = ask_amount ? _fbb.CreateVector<double>(*ask_amount) : 0;
407
239
  return hikyuu::flat::CreateSpot(
408
240
  _fbb,
409
241
  market__,
@@ -417,26 +249,10 @@ inline ::flatbuffers::Offset<Spot> CreateSpotDirect(
417
249
  close,
418
250
  amount,
419
251
  volume,
420
- bid1,
421
- bid1_amount,
422
- bid2,
423
- bid2_amount,
424
- bid3,
425
- bid3_amount,
426
- bid4,
427
- bid4_amount,
428
- bid5,
429
- bid5_amount,
430
- ask1,
431
- ask1_amount,
432
- ask2,
433
- ask2_amount,
434
- ask3,
435
- ask3_amount,
436
- ask4,
437
- ask4_amount,
438
- ask5,
439
- ask5_amount);
252
+ bid__,
253
+ bid_amount__,
254
+ ask__,
255
+ ask_amount__);
440
256
  }
441
257
 
442
258
  struct SpotList FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
@@ -14,7 +14,7 @@ namespace hku {
14
14
  /**
15
15
  * 获取全局调度实例指针
16
16
  */
17
- TimerManager *getScheduler();
17
+ HKU_API TimerManager* getScheduler();
18
18
 
19
19
  /**
20
20
  * 用于程序退出时释放全局调度实例,仅内部使用
@@ -205,6 +205,43 @@ public:
205
205
 
206
206
  string str() const;
207
207
 
208
+ public:
209
+ class Iterator {
210
+ private:
211
+ const Indicator& container;
212
+ size_t index;
213
+
214
+ public:
215
+ Iterator(const Indicator& cont, size_t idx) : container(cont), index(idx) {}
216
+
217
+ Iterator& operator++() {
218
+ index++;
219
+ return *this;
220
+ }
221
+
222
+ value_t operator*() const {
223
+ return container.get(index);
224
+ }
225
+
226
+ bool operator!=(const Iterator& other) const {
227
+ return index != other.index;
228
+ }
229
+
230
+ bool operator==(const Iterator& other) const {
231
+ return index == other.index;
232
+ }
233
+ };
234
+
235
+ Iterator begin() const {
236
+ return Iterator(*this, 0);
237
+ }
238
+
239
+ Iterator end() const {
240
+ return Iterator(*this, size());
241
+ }
242
+
243
+ typedef Iterator iterator;
244
+
208
245
  protected:
209
246
  IndicatorImpPtr m_imp;
210
247
 
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-08-09
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <string>
11
+
12
+ #ifndef HKU_API
13
+ #define HKU_API
14
+ #endif
15
+
16
+ namespace hku {
17
+
18
+ // 注意仅在 hikyuu 相关项目内部使用,避免对项目造成污染
19
+
20
+ void loadLocalLanguage(const std::string &path = "i8n");
21
+
22
+ std::string HKU_API htr(const char *id);
23
+
24
+ // 按上下文获取翻译
25
+ std::string HKU_API hctr(const char *ctx, const char *id);
26
+
27
+ } // namespace hku
@@ -17,15 +17,23 @@ public:
17
17
  KDataToHdf5Importer();
18
18
  virtual ~KDataToHdf5Importer();
19
19
 
20
- bool setConfig(const string& datapath, const vector<string>& markets = {"SH", "SZ", "BJ"});
20
+ bool setConfig(const string& datapath, const vector<string>& markets = {"SH", "SZ", "BJ"},
21
+ const vector<string>& ktypes = {"DAY", "MIN", "MIN5", "TIMELINE", "TRANSDATA"});
21
22
 
22
23
  Datetime getLastDatetime(const string& market, const string& code, const KQuery::KType& ktype);
23
24
 
24
25
  void addKRecordList(const string& market, const string& code, const vector<KRecord>& krecords,
25
26
  const KQuery::KType& ktype);
26
27
 
28
+ void addTimeLineList(const string& market, const string& code, const TimeLineList& timeline);
29
+
30
+ void addTransList(const string& market, const string& code, const TransRecordList& translist);
31
+
27
32
  void updateIndex(const string& market, const string& code, const KQuery::KType& ktype);
28
33
 
34
+ void remove(const string& market, const string& code, const KQuery::KType& ktype,
35
+ Datetime start);
36
+
29
37
  private:
30
38
  ImportKDataToHdf5PluginInterface* m_plugin{nullptr};
31
39
  };
@@ -8,11 +8,36 @@
8
8
  #pragma once
9
9
 
10
10
  #include "hikyuu/DataType.h"
11
+ #include "hikyuu/Stock.h"
12
+ #include "hikyuu/global/SpotRecord.h"
11
13
 
12
14
  namespace hku {
13
15
 
14
- void HKU_API startDataServer(const std::string& addr = "tcp://0.0.0.0:9201", size_t work_num = 2);
16
+ void HKU_API startDataServer(const std::string& addr = "tcp://0.0.0.0:9201", size_t work_num = 2,
17
+ bool save_tick = false, bool buf_tick = false);
15
18
 
16
19
  void HKU_API stopDataServer();
17
20
 
21
+ /**
22
+ * 从 dataserver 数据缓存服务器拉取更新最新的缓存数据
23
+ * @param addr 缓存服务地址,如: tcp://192.168.1.1:9201
24
+ * @param stklist 待更新的股票列表
25
+ * @param ktype 指定更新的K线类型
26
+ */
27
+ void HKU_API getDataFromBufferServer(const std::string& addr, const StockList& stklist,
28
+ const KQuery::KType& ktype);
29
+
30
+ /**
31
+ * @brief 从 dataserver 获取指定证券大于等于指定日期的缓存 spot 数据
32
+ * @param addr 缓存服务地址,如: tcp://192.168.1.1:9201
33
+ * @param market 市场代码
34
+ * @param code 证券代码
35
+ * @param datetime 查询时间
36
+ * @return vector<SpotRecord>
37
+ */
38
+ vector<SpotRecord> HKU_API getSpotFromBufferServer(const std::string& addr,
39
+ const std::string& market,
40
+ const std::string& code,
41
+ const Datetime& datetime);
42
+
18
43
  } // namespace hku
@@ -14,8 +14,9 @@ namespace hku {
14
14
  /**
15
15
  * @brief 激活设备
16
16
  * @param active_code 授权码
17
+ * @param replace 超过设备限制时,强制替换最早激活的设备
17
18
  */
18
- void HKU_API activeDevice(const std::string& active_code);
19
+ void HKU_API activeDevice(const std::string& active_code, bool replace = false);
19
20
 
20
21
  /** 查看授权信息 */
21
22
  std::string HKU_API viewLicense();
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-08-06
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/Stock.h"
11
+
12
+ namespace hku {
13
+
14
+ /**
15
+ * @brief 注册扩展 K 线类型, 按时间合成
16
+ * @param ktype 扩展 K 线类型
17
+ * @param basetype 对应的基础 K 线类型
18
+ * @param minutes 每根K线所包含的分钟数
19
+ * @param getPhaseEnd 获取K线所属的阶段结束时间
20
+ */
21
+ void HKU_API registerExtraKType(const string& ktype, const string& basetype, int32_t minutes,
22
+ std::function<Datetime(const Datetime&)> getPhaseEnd);
23
+
24
+ /**
25
+ * 注册K线扩展类型,按 bar 数量合成
26
+ * @param ktype 扩展 K 线类型
27
+ * @param basetype 对应的基础 K 线类型
28
+ * @param nbars 每根K线所包含的基础K线数
29
+ */
30
+ void HKU_API registerExtraKType(const string& ktype, const string& basetype, int32_t nbars);
31
+
32
+ /**
33
+ * 释放扩展K线
34
+ * @note 某些情况下,注册扩展K线时,使用了 python 定义的周期结束日期转换函数,退出时可能引起 python
35
+ * GIL 报错,需手工提前释放扩展K线
36
+ */
37
+ void HKU_API releaseExtraKType();
38
+
39
+ //-------------------------------
40
+ // 以下函数为内部使用,无需引出
41
+ //-------------------------------
42
+
43
+ bool isExtraKType(const string& ktype);
44
+
45
+ int32_t getKTypeExtraMinutes(const string& ktype);
46
+
47
+ std::vector<string> getExtraKTypeList();
48
+
49
+ KRecordList getExtraKRecordList(const Stock& stk, const KQuery& query);
50
+
51
+ size_t getStockExtraCount(const Stock& stk, const string& ktype);
52
+
53
+ bool getStockExtraIndexRange(const Stock& stk, const KQuery& query, size_t& out_start,
54
+ size_t& out_end);
55
+
56
+ } // namespace hku
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-07-01
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "hikyuu/data_driver/KDataDriver.h"
11
+ #include "hikyuu/data_driver/BlockInfoDriver.h"
12
+ #include "hikyuu/data_driver/BaseInfoDriver.h"
13
+ #include "hikyuu/utilities/plugin/PluginBase.h"
14
+
15
+ namespace hku {
16
+
17
+ class DataDriverPluginInterface : public PluginBase {
18
+ public:
19
+ DataDriverPluginInterface() = default;
20
+ virtual ~DataDriverPluginInterface() = default;
21
+
22
+ virtual KDataDriverPtr getKDataDriver() = 0;
23
+ virtual BlockInfoDriverPtr getBlockInfoDriver() = 0;
24
+ virtual BaseInfoDriverPtr getBaseInfoDriver() = 0;
25
+ };
26
+
27
+ } // namespace hku
@@ -16,7 +16,8 @@ public:
16
16
  DataServerPluginInterface() = default;
17
17
  virtual ~DataServerPluginInterface() = default;
18
18
 
19
- virtual void start(const std::string& addr, size_t work_num) noexcept = 0;
19
+ virtual void start(const std::string& addr, size_t work_num, bool save_tick,
20
+ bool buf_tick) noexcept = 0;
20
21
  virtual void stop() noexcept = 0;
21
22
  };
22
23
 
@@ -16,7 +16,7 @@ public:
16
16
  DevicePluginInterface() = default;
17
17
  virtual ~DevicePluginInterface() = default;
18
18
 
19
- virtual void activate(const std::string& active_code) noexcept = 0;
19
+ virtual void activate(const std::string& active_code, bool replace) noexcept = 0;
20
20
  virtual std::string viewLicense() noexcept = 0;
21
21
  virtual void removeLicense() noexcept = 0;
22
22
  virtual std::string fetchTrialLicense(const std::string& email) noexcept = 0;