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.
- hikyuu/__init__.py +16 -0
- hikyuu/__init__.pyi +484 -474
- hikyuu/analysis/__init__.pyi +466 -445
- hikyuu/analysis/analysis.pyi +467 -446
- hikyuu/core.pyi +468 -447
- hikyuu/cpp/boost_date_time-mt.dll +0 -0
- hikyuu/cpp/boost_serialization-mt.dll +0 -0
- hikyuu/cpp/boost_wserialization-mt.dll +0 -0
- hikyuu/cpp/core310.pyd +0 -0
- hikyuu/cpp/core310.pyi +1070 -878
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +1070 -878
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +1070 -878
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +1070 -876
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/core39.pyi +1070 -878
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/i18n/__init__.py +0 -0
- hikyuu/cpp/i18n/zh_CN/__init__.py +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/data/clickhouse_upgrade/__init__.py +1 -0
- hikyuu/data/clickhouse_upgrade/createdb.sql +1085 -0
- hikyuu/data/common_clickhouse.py +465 -0
- hikyuu/data/em_block_to_clickhouse.py +120 -0
- hikyuu/data/hku_config_template.py +58 -3
- hikyuu/data/pytdx_finance_to_clickhouse.py +107 -0
- hikyuu/data/pytdx_to_clickhouse.py +841 -0
- hikyuu/data/pytdx_to_mysql.py +4 -4
- hikyuu/data/pytdx_weight_to_clickhouse.py +191 -0
- hikyuu/data/tdx_to_clickhouse.py +448 -0
- hikyuu/data/tdx_to_h5.py +1 -1
- hikyuu/data/zh_bond10_to_clickhouse.py +49 -0
- hikyuu/draw/__init__.pyi +1 -1
- hikyuu/draw/drawplot/bokeh_draw.pyi +479 -471
- hikyuu/draw/drawplot/echarts_draw.py +9 -8
- hikyuu/draw/drawplot/echarts_draw.pyi +479 -471
- hikyuu/draw/drawplot/matplotlib_draw.py +3 -3
- hikyuu/draw/drawplot/matplotlib_draw.pyi +479 -471
- hikyuu/draw/elder.pyi +6 -6
- hikyuu/draw/kaufman.py +1 -1
- hikyuu/draw/kaufman.pyi +10 -10
- hikyuu/draw/volume.pyi +5 -5
- hikyuu/examples/notebook/000-Index.ipynb +1 -1
- hikyuu/examples/notebook/001-overview.ipynb +78 -63
- hikyuu/examples/notebook/002-HowToGetStock.ipynb +259 -40
- hikyuu/examples/notebook/003-HowToGetKDataAndDraw.ipynb +49 -41
- hikyuu/examples/notebook/004-IndicatorOverview.ipynb +29 -29
- hikyuu/examples/notebook/005-Drawplot.ipynb +66 -37
- hikyuu/examples/notebook/006-TradeManager.ipynb +808 -61
- hikyuu/examples/notebook/007-SystemDetails.ipynb +23 -23
- hikyuu/examples/notebook/009-RealData.ipynb +3 -3
- hikyuu/examples/notebook/010-Portfolio.ipynb +761 -122
- hikyuu/extend.py +15 -100
- hikyuu/extend.pyi +478 -493
- hikyuu/fetcher/stock/zh_stock_a_pytdx.py +9 -20
- hikyuu/fetcher/stock/zh_stock_a_qmt.py +4 -5
- hikyuu/fetcher/stock/zh_stock_a_sina_qq.py +16 -60
- hikyuu/flat/Spot.py +96 -200
- hikyuu/gui/HikyuuTDX.py +134 -7
- hikyuu/gui/data/ImportBlockInfoTask.py +11 -0
- hikyuu/gui/data/ImportHistoryFinanceTask.py +15 -1
- hikyuu/gui/data/ImportPytdxTimeToH5Task.py +11 -1
- hikyuu/gui/data/ImportPytdxToH5Task.py +13 -1
- hikyuu/gui/data/ImportPytdxTransToH5Task.py +11 -1
- hikyuu/gui/data/ImportTdxToH5Task.py +13 -1
- hikyuu/gui/data/ImportWeightToSqliteTask.py +14 -1
- hikyuu/gui/data/ImportZhBond10Task.py +11 -0
- hikyuu/gui/data/MainWindow.py +210 -135
- hikyuu/gui/data/UsePytdxImportToH5Thread.py +45 -26
- hikyuu/gui/data/UseTdxImportToH5Thread.py +19 -1
- hikyuu/gui/dataserver.py +12 -4
- hikyuu/gui/spot_server.py +30 -40
- hikyuu/gui/start_qmt.py +20 -3
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/DataType.h +2 -0
- hikyuu/include/hikyuu/KQuery.h +22 -28
- hikyuu/include/hikyuu/MarketInfo.h +1 -1
- hikyuu/include/hikyuu/Stock.h +15 -3
- hikyuu/include/hikyuu/StockManager.h +12 -3
- hikyuu/include/hikyuu/StockTypeInfo.h +6 -0
- hikyuu/include/hikyuu/TransRecord.h +2 -8
- hikyuu/include/hikyuu/data_driver/kdata/mysql/KRecordTable.h +1 -0
- hikyuu/include/hikyuu/doc.h +4 -0
- hikyuu/include/hikyuu/global/GlobalSpotAgent.h +1 -1
- hikyuu/include/hikyuu/global/SpotRecord.h +15 -31
- hikyuu/include/hikyuu/global/agent/spot_generated.h +48 -232
- hikyuu/include/hikyuu/global/schedule/scheduler.h +1 -1
- hikyuu/include/hikyuu/indicator/Indicator.h +37 -0
- hikyuu/include/hikyuu/lang.h +27 -0
- hikyuu/include/hikyuu/plugin/KDataToHdf5Importer.h +9 -1
- hikyuu/include/hikyuu/plugin/dataserver.h +26 -1
- hikyuu/include/hikyuu/plugin/device.h +2 -1
- hikyuu/include/hikyuu/plugin/hkuextra.h +56 -0
- hikyuu/include/hikyuu/plugin/interface/DataDriverPluginInterface.h +27 -0
- hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -1
- hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +1 -1
- hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +38 -0
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToHdf5PluginInterface.h +13 -1
- hikyuu/include/hikyuu/plugin/interface/plugins.h +4 -0
- hikyuu/include/hikyuu/python/pybind_utils.h +9 -0
- hikyuu/include/hikyuu/strategy/Strategy.h +0 -9
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +1 -1
- hikyuu/include/hikyuu/utilities/config.h +0 -2
- hikyuu/include/hikyuu/utilities/os.h +9 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +2 -1
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/include/hikyuu/view/MarketView.h +59 -0
- hikyuu/indicator/__init__.py +0 -1
- hikyuu/indicator/indicator.py +14 -53
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/clickhousedriver.dll +0 -0
- hikyuu/plugin/dataserver.dll +0 -0
- hikyuu/plugin/device.dll +0 -0
- hikyuu/plugin/extind.dll +0 -0
- hikyuu/plugin/hkuextra.dll +0 -0
- hikyuu/plugin/import2hdf5.dll +0 -0
- hikyuu/plugin/tmreport.dll +0 -0
- hikyuu/test/test_init.py +59 -0
- hikyuu/test/test_real_tdx_import.py +336 -0
- hikyuu/test/test_tdx_import.py +315 -0
- hikyuu/test/test_tdx_real_data_import.py +281 -0
- hikyuu/trade_manage/__init__.pyi +479 -471
- hikyuu/trade_manage/trade.py +4 -65
- hikyuu/trade_manage/trade.pyi +479 -483
- hikyuu/trade_sys/__init__.py +11 -0
- hikyuu/util/__init__.py +1 -0
- hikyuu/util/__init__.pyi +4 -4
- hikyuu/util/check.py +8 -0
- hikyuu/util/check.pyi +5 -1
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/METADATA +7 -5
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/RECORD +142 -124
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/top_level.txt +4 -3
- hikyuu/include/hikyuu/global/agent/hikyuu/flat/__init__.py +0 -1
- hikyuu/include/hikyuu/utilities/mo/__init__.py +0 -1
- hikyuu/include/hikyuu/utilities/mo/mo.h +0 -48
- hikyuu/indicator/talib_wrap.py +0 -1273
- /hikyuu/include/hikyuu/utilities/{mo/moFileReader.h → moFileReader.h} +0 -0
- /hikyuu/include/hikyuu/{global/agent/hikyuu → view}/__init__.py +0 -0
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/LICENSE +0 -0
- {hikyuu-2.6.5.dist-info → hikyuu-2.6.7.dist-info}/WHEEL +0 -0
- {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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
94
|
-
return
|
|
77
|
+
const ::flatbuffers::Vector<double> *bid() const {
|
|
78
|
+
return GetPointer<const ::flatbuffers::Vector<double> *>(VT_BID);
|
|
95
79
|
}
|
|
96
|
-
double
|
|
97
|
-
return
|
|
80
|
+
const ::flatbuffers::Vector<double> *bid_amount() const {
|
|
81
|
+
return GetPointer<const ::flatbuffers::Vector<double> *>(VT_BID_AMOUNT);
|
|
98
82
|
}
|
|
99
|
-
double
|
|
100
|
-
return
|
|
83
|
+
const ::flatbuffers::Vector<double> *ask() const {
|
|
84
|
+
return GetPointer<const ::flatbuffers::Vector<double> *>(VT_ASK);
|
|
101
85
|
}
|
|
102
|
-
double
|
|
103
|
-
return
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
|
232
|
-
fbb_.
|
|
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
|
|
283
|
-
fbb_.
|
|
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
|
|
286
|
-
fbb_.
|
|
161
|
+
void add_ask(::flatbuffers::Offset<::flatbuffers::Vector<double>> ask) {
|
|
162
|
+
fbb_.AddOffset(Spot::VT_ASK, ask);
|
|
287
163
|
}
|
|
288
|
-
void
|
|
289
|
-
fbb_.
|
|
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
|
|
316
|
-
double
|
|
317
|
-
double
|
|
318
|
-
double
|
|
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
|
|
384
|
-
double
|
|
385
|
-
double
|
|
386
|
-
double
|
|
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
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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 {
|
|
@@ -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
|
|
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;
|