hikyuu 2.6.3__py3-none-win_amd64.whl → 2.6.6__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 +6 -0
  2. hikyuu/__init__.pyi +548 -546
  3. hikyuu/analysis/__init__.pyi +519 -514
  4. hikyuu/analysis/analysis.pyi +520 -515
  5. hikyuu/core.pyi +521 -516
  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 +167 -36
  12. hikyuu/cpp/core311.pyd +0 -0
  13. hikyuu/cpp/core311.pyi +167 -36
  14. hikyuu/cpp/core312.pyd +0 -0
  15. hikyuu/cpp/core312.pyi +167 -36
  16. hikyuu/cpp/core313.pyd +0 -0
  17. hikyuu/cpp/core313.pyi +167 -36
  18. hikyuu/cpp/core39.pyd +0 -0
  19. hikyuu/cpp/core39.pyi +167 -36
  20. hikyuu/cpp/hikyuu.dll +0 -0
  21. hikyuu/cpp/hikyuu.lib +0 -0
  22. hikyuu/cpp/i18n/__init__.py +0 -0
  23. hikyuu/cpp/i18n/zh_CN.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.py +1 -1
  28. hikyuu/data/common_clickhouse.py +512 -0
  29. hikyuu/data/common_mysql.py +19 -0
  30. hikyuu/data/common_pytdx.py +2 -0
  31. hikyuu/data/common_sqlite3.py +1 -0
  32. hikyuu/data/em_block_to_clickhouse.py +120 -0
  33. hikyuu/data/hku_config_template.py +70 -1
  34. hikyuu/data/mysql_upgrade/0028.sql +95 -0
  35. hikyuu/data/pytdx_finance_to_clickhouse.py +107 -0
  36. hikyuu/data/pytdx_to_clickhouse.py +841 -0
  37. hikyuu/data/pytdx_to_h5.py +53 -13
  38. hikyuu/data/pytdx_to_mysql.py +42 -9
  39. hikyuu/data/pytdx_to_taos.py +736 -0
  40. hikyuu/data/pytdx_weight_to_clickhouse.py +191 -0
  41. hikyuu/data/sqlite_upgrade/0028.sql +97 -0
  42. hikyuu/data/tdx_to_clickhouse.py +448 -0
  43. hikyuu/data/zh_bond10_to_clickhouse.py +49 -0
  44. hikyuu/draw/__init__.pyi +1 -1
  45. hikyuu/draw/drawplot/__init__.pyi +8 -8
  46. hikyuu/draw/drawplot/bokeh_draw.pyi +538 -536
  47. hikyuu/draw/drawplot/common.pyi +1 -1
  48. hikyuu/draw/drawplot/echarts_draw.pyi +540 -538
  49. hikyuu/draw/drawplot/matplotlib_draw.py +7 -7
  50. hikyuu/draw/drawplot/matplotlib_draw.pyi +550 -548
  51. hikyuu/draw/elder.pyi +11 -11
  52. hikyuu/draw/kaufman.pyi +18 -18
  53. hikyuu/draw/volume.pyi +10 -10
  54. hikyuu/examples/notebook/001-overview.ipynb +65 -100
  55. hikyuu/examples/notebook/004-IndicatorOverview.ipynb +34 -32
  56. hikyuu/examples/notebook/007-SystemDetails.ipynb +64 -50
  57. hikyuu/examples/notebook/010-Portfolio.ipynb +120 -124
  58. hikyuu/extend.py +1 -1
  59. hikyuu/extend.pyi +527 -527
  60. hikyuu/fetcher/stock/zh_block_em.py +349 -5
  61. hikyuu/fetcher/stock/zh_stock_a_pytdx.py +11 -21
  62. hikyuu/fetcher/stock/zh_stock_a_qmt.py +4 -5
  63. hikyuu/fetcher/stock/zh_stock_a_sina_qq.py +16 -60
  64. hikyuu/flat/Spot.py +96 -200
  65. hikyuu/gui/HikyuuTDX.py +175 -23
  66. hikyuu/gui/data/ImportBlockInfoTask.py +12 -1
  67. hikyuu/gui/data/ImportHistoryFinanceTask.py +62 -44
  68. hikyuu/gui/data/ImportPytdxTimeToH5Task.py +14 -2
  69. hikyuu/gui/data/ImportPytdxToH5Task.py +17 -3
  70. hikyuu/gui/data/ImportPytdxTransToH5Task.py +14 -2
  71. hikyuu/gui/data/ImportTdxToH5Task.py +13 -1
  72. hikyuu/gui/data/ImportWeightToSqliteTask.py +16 -2
  73. hikyuu/gui/data/ImportZhBond10Task.py +12 -1
  74. hikyuu/gui/data/MainWindow.py +191 -110
  75. hikyuu/gui/data/UsePytdxImportToH5Thread.py +52 -29
  76. hikyuu/gui/data/UseQmtImportToH5Thread.py +1 -0
  77. hikyuu/gui/data/UseTdxImportToH5Thread.py +21 -2
  78. hikyuu/gui/dataserver.py +12 -4
  79. hikyuu/gui/spot_server.py +30 -40
  80. hikyuu/gui/start_qmt.py +20 -3
  81. hikyuu/hub.pyi +6 -6
  82. hikyuu/include/hikyuu/DataType.h +11 -0
  83. hikyuu/include/hikyuu/MarketInfo.h +6 -0
  84. hikyuu/include/hikyuu/StockManager.h +8 -0
  85. hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +35 -0
  86. hikyuu/include/hikyuu/data_driver/kdata/mysql/KRecordTable.h +1 -0
  87. hikyuu/include/hikyuu/global/GlobalSpotAgent.h +1 -1
  88. hikyuu/include/hikyuu/global/SpotRecord.h +15 -31
  89. hikyuu/include/hikyuu/global/agent/spot_generated.h +48 -232
  90. hikyuu/include/hikyuu/global/schedule/scheduler.h +1 -1
  91. hikyuu/include/hikyuu/indicator/build_in.h +1 -0
  92. hikyuu/include/hikyuu/indicator/crt/BARSLASTCOUNT.h +33 -0
  93. hikyuu/include/hikyuu/indicator/imp/IBarsLastCount.h +27 -0
  94. hikyuu/include/hikyuu/plugin/KDataToHdf5Importer.h +3 -0
  95. hikyuu/include/hikyuu/plugin/backtest.h +2 -2
  96. hikyuu/include/hikyuu/plugin/dataserver.h +26 -1
  97. hikyuu/include/hikyuu/plugin/device.h +8 -4
  98. hikyuu/include/hikyuu/plugin/interface/BackTestPluginInterface.h +1 -1
  99. hikyuu/include/hikyuu/plugin/interface/DataDriverPluginInterface.h +27 -0
  100. hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -1
  101. hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +2 -1
  102. hikyuu/include/hikyuu/plugin/interface/ImportKDataToHdf5PluginInterface.h +3 -0
  103. hikyuu/include/hikyuu/plugin/interface/TMReportPluginInterface.h +80 -0
  104. hikyuu/include/hikyuu/plugin/interface/plugins.h +4 -0
  105. hikyuu/include/hikyuu/strategy/Strategy.h +0 -9
  106. hikyuu/include/hikyuu/trade_manage/Performance.h +17 -9
  107. hikyuu/include/hikyuu/trade_manage/PositionExtInfo.h +92 -0
  108. hikyuu/include/hikyuu/trade_manage/PositionRecord.h +7 -1
  109. hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +60 -1
  110. hikyuu/include/hikyuu/trade_sys/selector/crt/SE_Optimal.h +8 -0
  111. hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/OptimalEvaluateSelector.h +28 -0
  112. hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/OptimalSelectorBase.h +1 -0
  113. hikyuu/include/hikyuu/utilities/DllLoader.h +226 -0
  114. hikyuu/include/hikyuu/utilities/config.h +1 -1
  115. hikyuu/include/hikyuu/utilities/datetime/Datetime.h +20 -0
  116. hikyuu/include/hikyuu/utilities/datetime/TimeDelta.h +6 -0
  117. hikyuu/include/hikyuu/utilities/mo/mo.h +30 -14
  118. hikyuu/include/hikyuu/utilities/os.h +6 -0
  119. hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +10 -10
  120. hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +13 -7
  121. hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +13 -6
  122. hikyuu/include/hikyuu/version.h +4 -4
  123. hikyuu/plugin/backtest.dll +0 -0
  124. hikyuu/plugin/clickhousedriver.dll +0 -0
  125. hikyuu/plugin/dataserver.dll +0 -0
  126. hikyuu/plugin/device.dll +0 -0
  127. hikyuu/plugin/extind.dll +0 -0
  128. hikyuu/plugin/import2hdf5.dll +0 -0
  129. hikyuu/plugin/tmreport.dll +0 -0
  130. hikyuu/trade_manage/__init__.pyi +537 -535
  131. hikyuu/trade_manage/broker.pyi +3 -3
  132. hikyuu/trade_manage/broker_easytrader.pyi +1 -1
  133. hikyuu/trade_manage/trade.pyi +537 -535
  134. hikyuu/util/__init__.py +1 -0
  135. hikyuu/util/__init__.pyi +4 -3
  136. hikyuu/util/check.py +8 -0
  137. hikyuu/util/check.pyi +5 -1
  138. hikyuu/util/singleton.pyi +1 -1
  139. {hikyuu-2.6.3.dist-info → hikyuu-2.6.6.dist-info}/METADATA +4 -3
  140. {hikyuu-2.6.3.dist-info → hikyuu-2.6.6.dist-info}/RECORD +144 -123
  141. {hikyuu-2.6.3.dist-info → hikyuu-2.6.6.dist-info}/top_level.txt +2 -2
  142. hikyuu/include/hikyuu/global/agent/hikyuu/__init__.py +0 -1
  143. hikyuu/include/hikyuu/global/agent/hikyuu/flat/__init__.py +0 -1
  144. {hikyuu-2.6.3.dist-info → hikyuu-2.6.6.dist-info}/LICENSE +0 -0
  145. {hikyuu-2.6.3.dist-info → hikyuu-2.6.6.dist-info}/WHEEL +0 -0
  146. {hikyuu-2.6.3.dist-info → hikyuu-2.6.6.dist-info}/entry_points.txt +0 -0
@@ -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
  * 用于程序退出时释放全局调度实例,仅内部使用
@@ -24,6 +24,7 @@
24
24
  #include "crt/BACKSET.h"
25
25
  #include "crt/BARSCOUNT.h"
26
26
  #include "crt/BARSLAST.h"
27
+ #include "crt/BARSLASTCOUNT.h"
27
28
  #include "crt/BARSSINCE.h"
28
29
  #include "crt/BETWEEN.h"
29
30
  #include "crt/BLOCKSETNUM.h"
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-06-01
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+ #ifndef INDICATOR_CRT_BARSLASTCOUNT_H_
10
+ #define INDICATOR_CRT_BARSLASTCOUNT_H_
11
+
12
+ #include "CVAL.h"
13
+
14
+ namespace hku {
15
+
16
+ /**
17
+ * 统计连续满足条件的周期数
18
+ * @details
19
+ * <pre>
20
+ * 用法:BARSLASTCOUNT(X),其中X为条件表达式。
21
+ * 例如:BARSLASTCOUNT(CLOSE>OPEN)表示统计连续收阳的周期数
22
+ * </pre>
23
+ * @ingroup Indicator
24
+ */
25
+ Indicator HKU_API BARSLASTCOUNT();
26
+
27
+ inline Indicator BARSLASTCOUNT(const Indicator& ind) {
28
+ return BARSLASTCOUNT()(ind);
29
+ }
30
+
31
+ } // namespace hku
32
+
33
+ #endif /* INDICATOR_CRT_BARSLASTCOUNT_H_ */
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-06-01
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+ #ifndef INDICATOR_IMP_IBARSLASTCOUNT_H_
10
+ #define INDICATOR_IMP_IBARSLASTCOUNT_H_
11
+
12
+ #include "../Indicator.h"
13
+
14
+ namespace hku {
15
+
16
+ /* 统计连续满足条件的周期数 */
17
+ class IBarsLastCount : public IndicatorImp {
18
+ INDICATOR_IMP(IBarsLastCount)
19
+ INDICATOR_IMP_NO_PRIVATE_MEMBER_SERIALIZATION
20
+
21
+ public:
22
+ IBarsLastCount();
23
+ virtual ~IBarsLastCount();
24
+ };
25
+
26
+ } /* namespace hku */
27
+ #endif /* INDICATOR_IMP_IBARSLASTCOUNT_H_ */
@@ -26,6 +26,9 @@ public:
26
26
 
27
27
  void updateIndex(const string& market, const string& code, const KQuery::KType& ktype);
28
28
 
29
+ void remove(const string& market, const string& code, const KQuery::KType& ktype,
30
+ Datetime start);
31
+
29
32
  private:
30
33
  ImportKDataToHdf5PluginInterface* m_plugin{nullptr};
31
34
  };
@@ -27,12 +27,12 @@ void HKU_API backtest(const StrategyContext& context, const std::function<void(S
27
27
  const TradeManagerPtr& tm, const Datetime& start_date,
28
28
  const Datetime& end_date = Null<Datetime>(),
29
29
  const KQuery::KType& ktype = KQuery::DAY, const string& ref_market = "SH",
30
- int mode = 0, bool support_short = false);
30
+ int mode = 0, bool support_short = false, SlippagePtr slip = SlippagePtr());
31
31
 
32
32
  // 仅在 sm.init 之后使用
33
33
  void HKU_API backtest(const std::function<void(Strategy*)>& on_bar, const TradeManagerPtr& tm,
34
34
  const Datetime& start_date, const Datetime& end_date = Null<Datetime>(),
35
35
  const KQuery::KType& ktype = KQuery::DAY, const string& ref_market = "SH",
36
- int mode = 0, bool support_short = false);
36
+ int mode = 0, bool support_short = false, SlippagePtr slip = SlippagePtr());
37
37
 
38
38
  } // namespace hku
@@ -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,16 +14,20 @@ 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();
22
23
 
23
- // 移除授权
24
+ /** 移除授权 */
24
25
  void HKU_API removeLicense();
25
26
 
26
- // 获取试用授权
27
+ /** 获取 trial 授权 */
27
28
  std::string HKU_API fetchTrialLicense(const std::string& email);
28
29
 
30
+ /** 检查授权是否有效 */
31
+ bool HKU_API isValidLicense();
32
+
29
33
  } // namespace hku
@@ -21,7 +21,7 @@ public:
21
21
  const std::function<void(Strategy*)>& on_bar, const TradeManagerPtr& tm,
22
22
  const Datetime& start_date, const Datetime& end_date,
23
23
  const KQuery::KType& ktype, const string& ref_market, int mode,
24
- bool support_short) = 0;
24
+ bool support_short, SlippagePtr slip) = 0;
25
25
  };
26
26
 
27
27
  } // 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,10 +16,11 @@ 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;
23
+ virtual bool isValidLicsense() noexcept = 0;
23
24
  };
24
25
 
25
26
  } // namespace hku
@@ -28,6 +28,9 @@ public:
28
28
 
29
29
  virtual void updateIndex(const string& market, const string& code,
30
30
  const KQuery::KType& ktype) = 0;
31
+
32
+ virtual void remove(const string& market, const string& code, const KQuery::KType& ktype,
33
+ Datetime start) = 0;
31
34
  };
32
35
 
33
36
  } // namespace hku
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Copyright (c) 2025 hikyuu.org
3
+ *
4
+ * Created on: 2025-05-27
5
+ * Author: fasiondog
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <vector>
11
+ #include "hikyuu/KQuery.h"
12
+ #include "hikyuu/trade_manage/TradeManagerBase.h"
13
+ #include "hikyuu/trade_manage/Performance.h"
14
+ #include "hikyuu/trade_manage/PositionExtInfo.h"
15
+ #include "hikyuu/utilities/plugin/PluginBase.h"
16
+
17
+ namespace hku {
18
+
19
+ class TMReportPluginInterface : public PluginBase {
20
+ public:
21
+ TMReportPluginInterface() = default;
22
+ virtual ~TMReportPluginInterface() = default;
23
+
24
+ // 获取账户截止至指定时刻的最大回撤百分比(包含该时刻)(仅根据收盘价计算)
25
+ virtual price_t getMaxPullBack(const TMPtr& tm, const Datetime& date,
26
+ const KQuery::KType& ktype) = 0;
27
+
28
+ /**
29
+ * @brief 获取账户历史持仓扩展详情
30
+ * @param tm 指定账户
31
+ * @param ktype k线类型
32
+ * @param trade_mode 交易模式,影响部分统计项: 0-收盘时交易, 1-下一开盘时交易
33
+ * @return std::vector<PositionExtInfo>
34
+ */
35
+ virtual std::vector<PositionExtInfo> getHistoryPositionExtInfoList(const TMPtr& tm,
36
+ const KQuery::KType& ktype,
37
+ int trade_mode) = 0;
38
+
39
+ /**
40
+ * @brief 获取账户最后交易时刻后持仓详情
41
+ * @param tm 指定账户
42
+ * @param current_time 当前时刻(需大于等于最后交易时刻)
43
+ * @param ktype k线类型
44
+ * @param trade_mode 交易模式,影响部分统计项: 0-收盘时交易, 1-下一开盘时交易
45
+ * @return std::vector<PositionExtInfo>
46
+ */
47
+ virtual std::vector<PositionExtInfo> getPositionExtInfoList(const TMPtr& tm,
48
+ const Datetime& current_time,
49
+ const KQuery::KType& ktype,
50
+ int trade_mode) = 0;
51
+
52
+ /**
53
+ * 统计截至某一时刻的系统绩效, datetime必须大于等于lastDatetime,
54
+ * 以便用于计算当前市值
55
+ * @param tm 指定的交易管理实例
56
+ * @param datetime 统计截止时刻
57
+ */
58
+ virtual Performance getExtPerformance(const TMPtr& tm, const Datetime& datetime,
59
+ const KQuery::KType& ktype) = 0;
60
+
61
+ /**
62
+ * @brief 获取指定截止时间前各月的收益百分比
63
+ * @param tm
64
+ * @param datetime
65
+ * @return std::vector<std::pair<Datetime, double>>
66
+ */
67
+ virtual std::vector<std::pair<Datetime, double>> getProfitPercentMonthly(
68
+ const TMPtr& tm, const Datetime& datetime) = 0;
69
+
70
+ /**
71
+ * @brief 获取指定截止时间前各年的收益百分比
72
+ * @param tm
73
+ * @param datetime
74
+ * @return std::vector<std::pair<Datetime, double>>
75
+ */
76
+ virtual std::vector<std::pair<Datetime, double>> getProfitPercentYearly(
77
+ const TMPtr& tm, const Datetime& datetime) = 0;
78
+ };
79
+
80
+ } // namespace hku