hikyuu 2.6.2__py3-none-win_amd64.whl → 2.6.3__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 +1 -1
- hikyuu/__init__.pyi +25 -9
- hikyuu/analysis/__init__.pyi +16 -0
- hikyuu/analysis/analysis.pyi +17 -1
- hikyuu/core.pyi +18 -2
- hikyuu/cpp/core310.pyd +0 -0
- hikyuu/cpp/core310.pyi +369 -41
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +369 -41
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +369 -41
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +369 -41
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/core39.pyi +369 -41
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/draw/drawplot/bokeh_draw.pyi +21 -5
- hikyuu/draw/drawplot/echarts_draw.pyi +21 -5
- hikyuu/draw/drawplot/matplotlib_draw.py +22 -0
- hikyuu/draw/drawplot/matplotlib_draw.pyi +21 -5
- hikyuu/draw/kaufman.py +2 -2
- hikyuu/draw/kaufman.pyi +2 -2
- hikyuu/extend.pyi +21 -5
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/Block.h +20 -0
- hikyuu/include/hikyuu/KQuery.h +8 -0
- hikyuu/include/hikyuu/Stock.h +1 -1
- hikyuu/include/hikyuu/StockManager.h +6 -0
- hikyuu/include/hikyuu/indicator/Indicator.h +5 -0
- hikyuu/include/hikyuu/indicator/IndicatorImp.h +8 -3
- hikyuu/include/hikyuu/indicator/crt/INSUM.h +5 -10
- hikyuu/include/hikyuu/indicator/crt/RSI.h +2 -18
- hikyuu/include/hikyuu/plugin/backtest.h +3 -2
- hikyuu/include/hikyuu/plugin/extind.h +150 -0
- hikyuu/include/hikyuu/plugin/interface/BackTestPluginInterface.h +2 -1
- hikyuu/include/hikyuu/plugin/interface/ExtendIndicatorsPluginInterface.h +26 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +2 -0
- hikyuu/include/hikyuu/strategy/BrokerTradeManager.h +7 -5
- hikyuu/include/hikyuu/strategy/Strategy.h +22 -9
- hikyuu/include/hikyuu/trade_manage/OrderBrokerBase.h +11 -4
- hikyuu/include/hikyuu/trade_manage/TradeManager.h +8 -5
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +6 -4
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +9 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +8 -5
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_EqualWeight.h +4 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICIRWeight.h +4 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICWeight.h +4 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_Weight.h +4 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/EqualWeightMultiFactor.h +2 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICIRMultiFactor.h +2 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICMultiFactor.h +2 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/WeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/system/TradeRequest.h +7 -4
- hikyuu/include/hikyuu/trade_sys/system/imp/WalkForwardTradeManager.h +17 -13
- hikyuu/include/hikyuu/utilities/thread/{MQStealThreadPool.h → GlobalMQStealThreadPool.h} +12 -12
- hikyuu/include/hikyuu/utilities/thread/GlobalMQThreadPool.h +271 -0
- hikyuu/include/hikyuu/utilities/thread/{StealThreadPool.h → GlobalStealThreadPool.h} +11 -10
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +224 -0
- hikyuu/include/hikyuu/utilities/thread/InterruptFlag.h +16 -0
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +27 -70
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +18 -53
- hikyuu/include/hikyuu/utilities/thread/ThreadSafeQueue.h +4 -0
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +9 -9
- hikyuu/include/hikyuu/utilities/thread/thread.h +4 -0
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/dataserver.dll +0 -0
- hikyuu/plugin/device.dll +0 -0
- hikyuu/plugin/extind.dll +0 -0
- hikyuu/plugin/import2hdf5.dll +0 -0
- hikyuu/trade_manage/__init__.pyi +21 -5
- hikyuu/trade_manage/broker.py +8 -8
- hikyuu/trade_manage/broker.pyi +4 -4
- hikyuu/trade_manage/broker_easytrader.py +3 -3
- hikyuu/trade_manage/broker_easytrader.pyi +2 -2
- hikyuu/trade_manage/broker_mail.py +2 -2
- hikyuu/trade_manage/broker_mail.pyi +2 -2
- hikyuu/trade_manage/trade.pyi +21 -5
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/METADATA +1 -1
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/RECORD +87 -82
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/LICENSE +0 -0
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/entry_points.txt +0 -0
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/top_level.txt +0 -0
|
@@ -54,7 +54,7 @@ public:
|
|
|
54
54
|
explicit MQThreadPool(size_t n, bool until_empty = true)
|
|
55
55
|
: m_done(false), m_worker_num(n), m_runnging_until_empty(until_empty) {
|
|
56
56
|
try {
|
|
57
|
-
|
|
57
|
+
m_thread_need_stop.resize(m_worker_num);
|
|
58
58
|
for (int i = 0; i < m_worker_num; i++) {
|
|
59
59
|
// 创建工作线程及其任务队列
|
|
60
60
|
m_queues.push_back(
|
|
@@ -105,7 +105,7 @@ public:
|
|
|
105
105
|
/** 向线程池提交任务 */
|
|
106
106
|
template <typename FunctionType>
|
|
107
107
|
auto submit(FunctionType f) {
|
|
108
|
-
if (
|
|
108
|
+
if (m_done) {
|
|
109
109
|
throw std::logic_error("You can't submit a task to the stopped MQThreadPool!");
|
|
110
110
|
}
|
|
111
111
|
|
|
@@ -117,15 +117,17 @@ public:
|
|
|
117
117
|
size_t min_count = std::numeric_limits<size_t>::max();
|
|
118
118
|
int index = 0;
|
|
119
119
|
for (int i = 0; i < m_worker_num; ++i) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
if (!m_thread_need_stop[i].isSet()) {
|
|
121
|
+
size_t cur_count = m_queues[i]->size();
|
|
122
|
+
if (cur_count == 0) {
|
|
123
|
+
index = i;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
if (cur_count < min_count) {
|
|
128
|
+
min_count = cur_count;
|
|
129
|
+
index = i;
|
|
130
|
+
}
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
133
|
|
|
@@ -146,17 +148,12 @@ public:
|
|
|
146
148
|
* 等待各线程完成当前执行的任务后立即结束退出
|
|
147
149
|
*/
|
|
148
150
|
void stop() {
|
|
149
|
-
if (m_done) {
|
|
151
|
+
if (m_done.exchange(true, std::memory_order_relaxed)) {
|
|
150
152
|
return;
|
|
151
153
|
}
|
|
152
154
|
|
|
153
|
-
m_done = true;
|
|
154
|
-
|
|
155
|
-
// 同时加入结束任务指示,以便在dll退出时也能够终止
|
|
156
155
|
for (size_t i = 0; i < m_worker_num; i++) {
|
|
157
|
-
|
|
158
|
-
m_interrupt_flags[i]->set();
|
|
159
|
-
}
|
|
156
|
+
m_thread_need_stop[i].set();
|
|
160
157
|
m_queues[i]->push(FuncWrapper());
|
|
161
158
|
}
|
|
162
159
|
|
|
@@ -181,33 +178,16 @@ public:
|
|
|
181
178
|
}
|
|
182
179
|
|
|
183
180
|
// 指示各工作线程在未获取到工作任务时,停止运行
|
|
184
|
-
if (m_runnging_until_empty) {
|
|
185
|
-
while (true) {
|
|
186
|
-
bool can_quit = true;
|
|
187
|
-
for (size_t i = 0; i < m_worker_num; i++) {
|
|
188
|
-
if (m_queues[i]->size() != 0) {
|
|
189
|
-
can_quit = false;
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (can_quit) {
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
std::this_thread::yield();
|
|
199
|
-
}
|
|
200
|
-
|
|
181
|
+
if (!m_runnging_until_empty) {
|
|
201
182
|
m_done = true;
|
|
202
183
|
for (size_t i = 0; i < m_worker_num; i++) {
|
|
203
|
-
|
|
204
|
-
m_interrupt_flags[i]->set();
|
|
205
|
-
}
|
|
184
|
+
m_thread_need_stop[i].set();
|
|
206
185
|
}
|
|
207
186
|
}
|
|
208
187
|
|
|
209
188
|
for (size_t i = 0; i < m_worker_num; i++) {
|
|
210
189
|
m_queues[i]->push(FuncWrapper());
|
|
190
|
+
m_queues[i]->notify_all();
|
|
211
191
|
}
|
|
212
192
|
|
|
213
193
|
// 等待线程结束
|
|
@@ -217,10 +197,6 @@ public:
|
|
|
217
197
|
}
|
|
218
198
|
}
|
|
219
199
|
|
|
220
|
-
for (size_t i = 0; i < m_worker_num; i++) {
|
|
221
|
-
m_queues[i]->clear();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
200
|
m_done = true;
|
|
225
201
|
}
|
|
226
202
|
|
|
@@ -231,38 +207,19 @@ private:
|
|
|
231
207
|
bool m_runnging_until_empty; // 运行直到队列空时停止
|
|
232
208
|
|
|
233
209
|
std::vector<std::unique_ptr<ThreadSafeQueue<task_type>>> m_queues; // 线程任务队列
|
|
234
|
-
std::vector<InterruptFlag
|
|
210
|
+
std::vector<InterruptFlag> m_thread_need_stop; // 线程终止标志
|
|
235
211
|
std::vector<std::thread> m_threads; // 工作线程
|
|
236
212
|
|
|
237
|
-
// 线程本地变量
|
|
238
|
-
#if CPP_STANDARD >= CPP_STANDARD_17 && !defined(__clang__)
|
|
239
|
-
inline static thread_local ThreadSafeQueue<task_type>* m_local_work_queue =
|
|
240
|
-
nullptr; // 本地任务队列
|
|
241
|
-
inline static thread_local int m_index = -1; // 在线程池中的序号
|
|
242
|
-
inline static thread_local InterruptFlag m_thread_need_stop; // 线程停止运行指示
|
|
243
|
-
#else
|
|
244
|
-
static thread_local ThreadSafeQueue<task_type>* m_local_work_queue; // 本地任务队列
|
|
245
|
-
static thread_local int m_index; // 在线程池中的序号
|
|
246
|
-
static thread_local InterruptFlag m_thread_need_stop; // 线程停止运行指示
|
|
247
|
-
#endif
|
|
248
|
-
|
|
249
213
|
void worker_thread(int index) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
static void run_pending_task() {
|
|
261
|
-
task_type task;
|
|
262
|
-
m_local_work_queue->wait_and_pop(task);
|
|
263
|
-
if (task.isNullTask()) {
|
|
264
|
-
m_thread_need_stop.set();
|
|
265
|
-
} else {
|
|
214
|
+
auto *local_queue = m_queues[index].get();
|
|
215
|
+
auto *local_stop_flag = &m_thread_need_stop[index];
|
|
216
|
+
while (!local_stop_flag->isSet() || !m_done) {
|
|
217
|
+
task_type task;
|
|
218
|
+
local_queue->wait_and_pop(task);
|
|
219
|
+
if (task.isNullTask()) {
|
|
220
|
+
local_stop_flag->set();
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
266
223
|
task();
|
|
267
224
|
}
|
|
268
225
|
}
|
|
@@ -19,16 +19,13 @@
|
|
|
19
19
|
#include "ThreadSafeQueue.h"
|
|
20
20
|
#include "InterruptFlag.h"
|
|
21
21
|
#include "../cppdef.h"
|
|
22
|
+
#include "../Log.h"
|
|
22
23
|
|
|
23
24
|
#ifdef __GNUC__
|
|
24
25
|
#pragma GCC diagnostic push
|
|
25
26
|
#pragma GCC diagnostic ignored "-Wsign-compare"
|
|
26
27
|
#endif
|
|
27
28
|
|
|
28
|
-
#ifndef HKU_UTILS_API
|
|
29
|
-
#define HKU_UTILS_API
|
|
30
|
-
#endif
|
|
31
|
-
|
|
32
29
|
namespace hku {
|
|
33
30
|
|
|
34
31
|
/**
|
|
@@ -37,11 +34,7 @@ namespace hku {
|
|
|
37
34
|
* @details
|
|
38
35
|
* @ingroup ThreadPool
|
|
39
36
|
*/
|
|
40
|
-
#ifdef _MSC_VER
|
|
41
37
|
class ThreadPool {
|
|
42
|
-
#else
|
|
43
|
-
class HKU_UTILS_API ThreadPool {
|
|
44
|
-
#endif
|
|
45
38
|
public:
|
|
46
39
|
/**
|
|
47
40
|
* 默认构造函数,创建和当前系统CPU数一致的线程数
|
|
@@ -56,7 +49,6 @@ public:
|
|
|
56
49
|
explicit ThreadPool(size_t n, bool until_empty = true)
|
|
57
50
|
: m_done(false), m_worker_num(n), m_running_until_empty(until_empty) {
|
|
58
51
|
try {
|
|
59
|
-
m_interrupt_flags.resize(m_worker_num, nullptr);
|
|
60
52
|
// 初始完毕所有线程资源后再启动线程
|
|
61
53
|
for (int i = 0; i < m_worker_num; i++) {
|
|
62
54
|
// 创建工作线程及其任务队列
|
|
@@ -94,7 +86,7 @@ public:
|
|
|
94
86
|
/** 向线程池提交任务 */
|
|
95
87
|
template <typename FunctionType>
|
|
96
88
|
auto submit(FunctionType f) {
|
|
97
|
-
if (
|
|
89
|
+
if (m_done) {
|
|
98
90
|
throw std::logic_error("You can't submit a task to the stopped task group!");
|
|
99
91
|
}
|
|
100
92
|
typedef typename std::invoke_result<FunctionType>::type result_type;
|
|
@@ -122,20 +114,17 @@ public:
|
|
|
122
114
|
* 等待各线程完成当前执行的任务后立即结束退出
|
|
123
115
|
*/
|
|
124
116
|
void stop() {
|
|
125
|
-
if (m_done) {
|
|
117
|
+
if (m_done.exchange(true, std::memory_order_relaxed)) {
|
|
126
118
|
return;
|
|
127
119
|
}
|
|
128
120
|
|
|
129
|
-
m_done = true;
|
|
130
|
-
|
|
131
121
|
// 同时加入结束任务指示,以便在dll退出时也能够终止
|
|
132
122
|
for (size_t i = 0; i < m_worker_num; i++) {
|
|
133
|
-
if (m_interrupt_flags[i]) {
|
|
134
|
-
m_interrupt_flags[i]->set();
|
|
135
|
-
}
|
|
136
123
|
m_master_work_queue.push(FuncWrapper());
|
|
137
124
|
}
|
|
138
125
|
|
|
126
|
+
m_master_work_queue.notify_all();
|
|
127
|
+
|
|
139
128
|
for (size_t i = 0; i < m_worker_num; i++) {
|
|
140
129
|
if (m_threads[i].joinable()) {
|
|
141
130
|
m_threads[i].join();
|
|
@@ -155,31 +144,25 @@ public:
|
|
|
155
144
|
}
|
|
156
145
|
|
|
157
146
|
// 指示各工作线程在未获取到工作任务时,停止运行
|
|
158
|
-
if (m_running_until_empty) {
|
|
159
|
-
while (m_master_work_queue.size() > 0) {
|
|
160
|
-
std::this_thread::yield();
|
|
161
|
-
}
|
|
147
|
+
if (!m_running_until_empty) {
|
|
162
148
|
m_done = true;
|
|
163
|
-
for (size_t i = 0; i < m_worker_num; i++) {
|
|
164
|
-
if (m_interrupt_flags[i]) {
|
|
165
|
-
m_interrupt_flags[i]->set();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
149
|
}
|
|
169
150
|
|
|
170
|
-
|
|
151
|
+
// 仍旧有可能某个线程没有获取到,导致没有终止
|
|
152
|
+
for (size_t i = 0; i < 2 * m_worker_num; i++) {
|
|
171
153
|
m_master_work_queue.push(FuncWrapper());
|
|
172
154
|
}
|
|
173
155
|
|
|
174
|
-
|
|
156
|
+
m_master_work_queue.notify_all();
|
|
157
|
+
|
|
175
158
|
for (size_t i = 0; i < m_worker_num; i++) {
|
|
176
159
|
if (m_threads[i].joinable()) {
|
|
177
160
|
m_threads[i].join();
|
|
178
161
|
}
|
|
179
162
|
}
|
|
180
163
|
|
|
181
|
-
m_master_work_queue.clear();
|
|
182
164
|
m_done = true;
|
|
165
|
+
m_master_work_queue.clear();
|
|
183
166
|
}
|
|
184
167
|
|
|
185
168
|
private:
|
|
@@ -190,36 +173,18 @@ private:
|
|
|
190
173
|
|
|
191
174
|
ThreadSafeQueue<task_type> m_master_work_queue; // 主线程任务队列
|
|
192
175
|
std::vector<std::thread> m_threads; // 工作线程
|
|
193
|
-
std::vector<InterruptFlag*> m_interrupt_flags; // 线程中断标志
|
|
194
|
-
|
|
195
|
-
// 线程本地变量
|
|
196
|
-
#if CPP_STANDARD >= CPP_STANDARD_17 && !defined(__clang__)
|
|
197
|
-
inline static thread_local InterruptFlag m_thread_need_stop; // 线程停止运行指示
|
|
198
|
-
inline static thread_local int m_index = -1; // 在线程池中的序号
|
|
199
|
-
#else
|
|
200
|
-
static thread_local InterruptFlag m_thread_need_stop; // 线程停止运行指示
|
|
201
|
-
static thread_local int m_index; // 在线程池中的序号
|
|
202
|
-
#endif
|
|
203
176
|
|
|
204
177
|
void worker_thread(int index) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
m_interrupt_flags[index] = nullptr;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
void run_pending_task() {
|
|
215
|
-
task_type task;
|
|
216
|
-
m_master_work_queue.wait_and_pop(task);
|
|
217
|
-
if (task.isNullTask()) {
|
|
218
|
-
m_thread_need_stop.set();
|
|
219
|
-
} else {
|
|
178
|
+
while (!m_done) {
|
|
179
|
+
task_type task;
|
|
180
|
+
m_master_work_queue.wait_and_pop(task);
|
|
181
|
+
if (task.isNullTask()) {
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
220
184
|
task();
|
|
221
185
|
}
|
|
222
186
|
}
|
|
187
|
+
|
|
223
188
|
}; // namespace hku
|
|
224
189
|
|
|
225
190
|
} /* namespace hku */
|
|
@@ -11,9 +11,13 @@
|
|
|
11
11
|
#include <functional>
|
|
12
12
|
#include <vector>
|
|
13
13
|
#include "ThreadPool.h"
|
|
14
|
-
#include "StealThreadPool.h"
|
|
15
14
|
#include "MQThreadPool.h"
|
|
16
|
-
|
|
15
|
+
|
|
16
|
+
//----------------------------------------------------------------
|
|
17
|
+
// Note: 除 ThreadPool/MQThreadPool 外,其他线程池由于使用
|
|
18
|
+
// 了 thread_local,本质为全局变量,只适合全局单例的方式使用,
|
|
19
|
+
// 否则会出现不同线程池示例互相影响导致出错。
|
|
20
|
+
//----------------------------------------------------------------
|
|
17
21
|
|
|
18
22
|
namespace hku {
|
|
19
23
|
|
|
@@ -26,10 +30,6 @@ inline std::vector<range_t> parallelIndexRange(size_t start, size_t end) {
|
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
size_t total = end - start;
|
|
29
|
-
if (total == 0) {
|
|
30
|
-
return ret;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
33
|
size_t cpu_num = std::thread::hardware_concurrency();
|
|
34
34
|
if (cpu_num == 1) {
|
|
35
35
|
ret.emplace_back(start, end);
|
|
@@ -51,7 +51,7 @@ inline std::vector<range_t> parallelIndexRange(size_t start, size_t end) {
|
|
|
51
51
|
return ret;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
template <typename FunctionType, class TaskGroup =
|
|
54
|
+
template <typename FunctionType, class TaskGroup = MQThreadPool>
|
|
55
55
|
void parallel_for_index_void(size_t start, size_t end, FunctionType f) {
|
|
56
56
|
auto ranges = parallelIndexRange(start, end);
|
|
57
57
|
TaskGroup tg;
|
|
@@ -66,7 +66,7 @@ void parallel_for_index_void(size_t start, size_t end, FunctionType f) {
|
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
template <typename FunctionType, class TaskGroup =
|
|
69
|
+
template <typename FunctionType, class TaskGroup = MQThreadPool>
|
|
70
70
|
auto parallel_for_index(size_t start, size_t end, FunctionType f) {
|
|
71
71
|
auto ranges = parallelIndexRange(start, end);
|
|
72
72
|
TaskGroup tg;
|
|
@@ -93,7 +93,7 @@ auto parallel_for_index(size_t start, size_t end, FunctionType f) {
|
|
|
93
93
|
return ret;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
template <typename FunctionType, class TaskGroup =
|
|
96
|
+
template <typename FunctionType, class TaskGroup = MQThreadPool>
|
|
97
97
|
auto parallel_for_range(size_t start, size_t end, FunctionType f) {
|
|
98
98
|
auto ranges = parallelIndexRange(start, end);
|
|
99
99
|
TaskGroup tg;
|
hikyuu/include/hikyuu/version.h
CHANGED
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
#define HKU_VERSION_H
|
|
13
13
|
|
|
14
14
|
// clang-format off
|
|
15
|
-
#define HKU_VERSION "2.6.
|
|
15
|
+
#define HKU_VERSION "2.6.3"
|
|
16
16
|
#define HKU_VERSION_MAJOR 2
|
|
17
17
|
#define HKU_VERSION_MINOR 6
|
|
18
|
-
#define HKU_VERSION_ALTER
|
|
19
|
-
#define HKU_VERSION_BUILD
|
|
18
|
+
#define HKU_VERSION_ALTER 3
|
|
19
|
+
#define HKU_VERSION_BUILD 202505252323
|
|
20
20
|
#define HKU_VERSION_MODE "RELEASE"
|
|
21
|
-
#define HKU_VERSION_GIT "2.6.
|
|
21
|
+
#define HKU_VERSION_GIT "2.6.3 release.127e122b (RELEASE)"
|
|
22
22
|
// clang-format on
|
|
23
23
|
|
|
24
24
|
#endif /* HKU_VERSION_H */
|
hikyuu/plugin/backtest.dll
CHANGED
|
Binary file
|
hikyuu/plugin/dataserver.dll
CHANGED
|
Binary file
|
hikyuu/plugin/device.dll
CHANGED
|
Binary file
|
hikyuu/plugin/extind.dll
ADDED
|
Binary file
|
hikyuu/plugin/import2hdf5.dll
CHANGED
|
Binary file
|
hikyuu/trade_manage/__init__.pyi
CHANGED
|
@@ -120,10 +120,10 @@ from hikyuu.cpp.core39 import KDataToHdf5Importer
|
|
|
120
120
|
from hikyuu.cpp.core39 import KRecord
|
|
121
121
|
from hikyuu.cpp.core39 import KRecordList
|
|
122
122
|
from hikyuu.cpp.core39 import LAST
|
|
123
|
-
from hikyuu.cpp.core39 import LASTVALUE
|
|
124
123
|
from hikyuu.cpp.core39 import LASTVALUE as CONST
|
|
125
|
-
from hikyuu.cpp.core39 import
|
|
124
|
+
from hikyuu.cpp.core39 import LASTVALUE
|
|
126
125
|
from hikyuu.cpp.core39 import LIUTONGPAN as CAPITAL
|
|
126
|
+
from hikyuu.cpp.core39 import LIUTONGPAN
|
|
127
127
|
from hikyuu.cpp.core39 import LLV
|
|
128
128
|
from hikyuu.cpp.core39 import LLVBARS
|
|
129
129
|
from hikyuu.cpp.core39 import LN
|
|
@@ -169,8 +169,8 @@ from hikyuu.cpp.core39 import PG_FixedPercent
|
|
|
169
169
|
from hikyuu.cpp.core39 import PG_NoGoal
|
|
170
170
|
from hikyuu.cpp.core39 import POS
|
|
171
171
|
from hikyuu.cpp.core39 import POW
|
|
172
|
-
from hikyuu.cpp.core39 import PRICELIST
|
|
173
172
|
from hikyuu.cpp.core39 import PRICELIST as VALUE
|
|
173
|
+
from hikyuu.cpp.core39 import PRICELIST
|
|
174
174
|
from hikyuu.cpp.core39 import Parameter
|
|
175
175
|
from hikyuu.cpp.core39 import Performance
|
|
176
176
|
from hikyuu.cpp.core39 import Portfolio
|
|
@@ -178,6 +178,7 @@ from hikyuu.cpp.core39 import PositionRecord
|
|
|
178
178
|
from hikyuu.cpp.core39 import PositionRecordList
|
|
179
179
|
from hikyuu.cpp.core39 import ProfitGoalBase
|
|
180
180
|
from hikyuu.cpp.core39 import Query
|
|
181
|
+
from hikyuu.cpp.core39 import RANK
|
|
181
182
|
from hikyuu.cpp.core39 import RECOVER_BACKWARD
|
|
182
183
|
from hikyuu.cpp.core39 import RECOVER_EQUAL_BACKWARD
|
|
183
184
|
from hikyuu.cpp.core39 import RECOVER_EQUAL_FORWARD
|
|
@@ -445,6 +446,21 @@ from hikyuu.cpp.core39 import VIGOR
|
|
|
445
446
|
from hikyuu.cpp.core39 import WEAVE
|
|
446
447
|
from hikyuu.cpp.core39 import WEEK
|
|
447
448
|
from hikyuu.cpp.core39 import WINNER
|
|
449
|
+
from hikyuu.cpp.core39 import WITHDAY
|
|
450
|
+
from hikyuu.cpp.core39 import WITHHALFYEAR
|
|
451
|
+
from hikyuu.cpp.core39 import WITHHOUR
|
|
452
|
+
from hikyuu.cpp.core39 import WITHHOUR2
|
|
453
|
+
from hikyuu.cpp.core39 import WITHHOUR4
|
|
454
|
+
from hikyuu.cpp.core39 import WITHKTYPE
|
|
455
|
+
from hikyuu.cpp.core39 import WITHMIN
|
|
456
|
+
from hikyuu.cpp.core39 import WITHMIN15
|
|
457
|
+
from hikyuu.cpp.core39 import WITHMIN30
|
|
458
|
+
from hikyuu.cpp.core39 import WITHMIN5
|
|
459
|
+
from hikyuu.cpp.core39 import WITHMIN60
|
|
460
|
+
from hikyuu.cpp.core39 import WITHMONTH
|
|
461
|
+
from hikyuu.cpp.core39 import WITHQUARTER
|
|
462
|
+
from hikyuu.cpp.core39 import WITHWEEK
|
|
463
|
+
from hikyuu.cpp.core39 import WITHYEAR
|
|
448
464
|
from hikyuu.cpp.core39 import WMA
|
|
449
465
|
from hikyuu.cpp.core39 import YEAR
|
|
450
466
|
from hikyuu.cpp.core39 import ZHBOND10
|
|
@@ -552,8 +568,8 @@ from hikyuu.util.mylog import add_class_logger_handler
|
|
|
552
568
|
from hikyuu.util.mylog import capture_multiprocess_all_logger
|
|
553
569
|
from hikyuu.util.mylog import class_logger
|
|
554
570
|
from hikyuu.util.mylog import hku_benchmark
|
|
555
|
-
from hikyuu.util.mylog import hku_debug
|
|
556
571
|
from hikyuu.util.mylog import hku_debug as hku_trace
|
|
572
|
+
from hikyuu.util.mylog import hku_debug
|
|
557
573
|
from hikyuu.util.mylog import hku_debug_if as hku_trace_if
|
|
558
574
|
from hikyuu.util.mylog import hku_debug_if
|
|
559
575
|
from hikyuu.util.mylog import hku_error
|
|
@@ -583,7 +599,7 @@ from . import broker
|
|
|
583
599
|
from . import broker_easytrader
|
|
584
600
|
from . import broker_mail
|
|
585
601
|
from . import trade
|
|
586
|
-
__all__ = ['ABS', 'ACOS', 'AD', 'ADVANCE', 'AF_EqualWeight', 'AF_FixedWeight', 'AF_FixedWeightList', 'AF_MultiFactor', 'ALIGN', 'AMA', 'AMO', 'ASIN', 'ATAN', 'ATR', 'AVEDEV', 'AllocateFundsBase', 'BACKSET', 'BARSCOUNT', 'BARSLAST', 'BARSSINCE', 'BARSSINCEN', 'BASE_DIR', 'BETWEEN', 'BLOCKSETNUM', 'BUSINESS', 'Block', 'BlockInfoDriver', 'BorrowRecord', 'BrokerPositionRecord', 'CAPITAL', 'CEILING', 'CLOSE', 'CN_Bool', 'CN_OPLine', 'CONST', 'CONTEXT', 'CONTEXT_K', 'CORR', 'COS', 'COST', 'COUNT', 'CROSS', 'CVAL', 'CYCLE', 'C_AMO', 'C_CLOSE', 'C_HIGH', 'C_KDATA', 'C_LOW', 'C_OPEN', 'C_VOL', 'ConditionBase', 'Constant', 'CostRecord', 'DATE', 'DAY', 'DEBUG', 'DECLINE', 'DEVSQ', 'DIFF', 'DIRECT', 'DISCARD', 'DMA', 'DOWNNDAY', 'DROPNA', 'DataDriverFactory', 'Datetime', 'DatetimeList', 'DatetimeList_to_df', 'DatetimeList_to_np', 'Datetime_date', 'Datetime_datetime', 'Days', 'EMA', 'ERROR', 'EVERY', 'EV_Bool', 'EV_TwoLine', 'EXIST', 'EXP', 'EasyTraderOrderBroker', 'EnvironmentBase', 'FATAL', 'FILTER', 'FINANCE', 'FLOOR', 'FundsRecord', 'HHV', 'HHVBARS', 'HIGH', 'HKUCheckError', 'HKUException', 'HOUR', 'HSL', 'Hours', 'IC', 'ICIR', 'IF', 'INBLOCK', 'INDEXA', 'INDEXADV', 'INDEXC', 'INDEXDEC', 'INDEXH', 'INDEXL', 'INDEXO', 'INDEXV', 'INFO', 'INSUM', 'INTPART', 'IR', 'ISINF', 'ISINFA', 'ISLASTBAR', 'ISNA', 'IndParam', 'Indicator', 'IndicatorImp', 'JUMPDOWN', 'JUMPUP', 'KALMAN', 'KDATA', 'KDATA_PART', 'KDJ', 'KData', 'KDataDriver', 'KDataToHdf5Importer', 'KData_getitem', 'KData_iter', 'KData_to_df', 'KData_to_np', 'KRecord', 'KRecordList', 'LAST', 'LASTVALUE', 'LIUTONGPAN', 'LLV', 'LLVBARS', 'LN', 'LOG', 'LOG_LEVEL', 'LONGCROSS', 'LOW', 'LoanRecord', 'LoggingContext', 'MA', 'MACD', 'MAX', 'MAXYEAR', 'MDD', 'MF_EqualWeight', 'MF_ICIRWeight', 'MF_ICWeight', 'MF_Weight', 'MIN', 'MINUTE', 'MINYEAR', 'MM_FixedCapital', 'MM_FixedCapitalFunds', 'MM_FixedCount', 'MM_FixedCountTps', 'MM_FixedPercent', 'MM_FixedRisk', 'MM_FixedUnits', 'MM_Nothing', 'MM_WilliamsFixedRisk', 'MOD', 'MONTH', 'MRR', 'MailOrderBroker', 'MarketInfo', 'Microseconds', 'Milliseconds', 'Minutes', 'MoneyManagerBase', 'MultiFactorBase', 'NDAY', 'NOT', 'OFF', 'OPEN', 'OrderBrokerBase', 'OrderBrokerWrap', 'PF_Simple', 'PF_WithoutAF', 'PG_FixedHoldDays', 'PG_FixedPercent', 'PG_NoGoal', 'POS', 'POW', 'PRICELIST', 'Parameter', 'Parameter_items', 'Parameter_iter', 'Parameter_keys', 'Parameter_to_dict', 'Path', 'Performance', 'Performance_to_df', 'Portfolio', 'PositionList_to_df', 'PositionList_to_np', 'PositionRecord', 'PositionRecordList', 'ProfitGoalBase', 'Query', 'RECOVER_BACKWARD', 'RECOVER_EQUAL_BACKWARD', 'RECOVER_EQUAL_FORWARD', 'RECOVER_FORWARD', 'REF', 'REPLACE', 'RESULT', 'REVERSE', 'ROC', 'ROCP', 'ROCR', 'ROCR100', 'ROUND', 'ROUNDDOWN', 'ROUNDUP', 'RSI', 'SAFTYLOSS', 'SE_Fixed', 'SE_MaxFundsOptimal', 'SE_MultiFactor', 'SE_PerformanceOptimal', 'SE_Signal', 'SGN', 'SG_Add', 'SG_AllwaysBuy', 'SG_And', 'SG_Band', 'SG_Bool', 'SG_Buy', 'SG_Cross', 'SG_CrossGold', 'SG_Cycle', 'SG_Div', 'SG_Flex', 'SG_Mul', 'SG_OneSide', 'SG_Or', 'SG_Sell', 'SG_Single', 'SG_Single2', 'SG_Sub', 'SIN', 'SLICE', 'SLOPE', 'SMA', 'SPEARMAN', 'SP_FixedPercent', 'SP_FixedValue', 'SQRT', 'STD', 'STDEV', 'STDP', 'ST_FixedPercent', 'ST_Indicator', 'ST_Saftyloss', 'SUM', 'SUMBARS', 'SYS_Simple', 'SYS_WalkForward', 'ScoreRecord', 'ScoreRecordList', 'Seconds', 'SelectorBase', 'SignalBase', 'SlippageBase', 'SpotRecord', 'Stock', 'StockManager', 'StockTypeInfo', 'StockWeight', 'StockWeightList', 'StoplossBase', 'Strategy', 'StrategyContext', 'System', 'SystemPart', 'SystemWeight', 'SystemWeightList', 'TAN', 'TA_ACCBANDS', 'TA_ACOS', 'TA_AD', 'TA_ADD', 'TA_ADOSC', 'TA_ADX', 'TA_ADXR', 'TA_APO', 'TA_AROON', 'TA_AROONOSC', 'TA_ASIN', 'TA_ATAN', 'TA_ATR', 'TA_AVGDEV', 'TA_AVGPRICE', 'TA_BBANDS', 'TA_BETA', 'TA_BOP', 'TA_CCI', 'TA_CDL2CROWS', 'TA_CDL3BLACKCROWS', 'TA_CDL3INSIDE', 'TA_CDL3LINESTRIKE', 'TA_CDL3OUTSIDE', 'TA_CDL3STARSINSOUTH', 'TA_CDL3WHITESOLDIERS', 'TA_CDLABANDONEDBABY', 'TA_CDLADVANCEBLOCK', 'TA_CDLBELTHOLD', 'TA_CDLBREAKAWAY', 'TA_CDLCLOSINGMARUBOZU', 'TA_CDLCONCEALBABYSWALL', 'TA_CDLCOUNTERATTACK', 'TA_CDLDARKCLOUDCOVER', 'TA_CDLDOJI', 'TA_CDLDOJISTAR', 'TA_CDLDRAGONFLYDOJI', 'TA_CDLENGULFING', 'TA_CDLEVENINGDOJISTAR', 'TA_CDLEVENINGSTAR', 'TA_CDLGAPSIDESIDEWHITE', 'TA_CDLGRAVESTONEDOJI', 'TA_CDLHAMMER', 'TA_CDLHANGINGMAN', 'TA_CDLHARAMI', 'TA_CDLHARAMICROSS', 'TA_CDLHIGHWAVE', 'TA_CDLHIKKAKE', 'TA_CDLHIKKAKEMOD', 'TA_CDLHOMINGPIGEON', 'TA_CDLIDENTICAL3CROWS', 'TA_CDLINNECK', 'TA_CDLINVERTEDHAMMER', 'TA_CDLKICKING', 'TA_CDLKICKINGBYLENGTH', 'TA_CDLLADDERBOTTOM', 'TA_CDLLONGLEGGEDDOJI', 'TA_CDLLONGLINE', 'TA_CDLMARUBOZU', 'TA_CDLMATCHINGLOW', 'TA_CDLMATHOLD', 'TA_CDLMORNINGDOJISTAR', 'TA_CDLMORNINGSTAR', 'TA_CDLONNECK', 'TA_CDLPIERCING', 'TA_CDLRICKSHAWMAN', 'TA_CDLRISEFALL3METHODS', 'TA_CDLSEPARATINGLINES', 'TA_CDLSHOOTINGSTAR', 'TA_CDLSHORTLINE', 'TA_CDLSPINNINGTOP', 'TA_CDLSTALLEDPATTERN', 'TA_CDLSTICKSANDWICH', 'TA_CDLTAKURI', 'TA_CDLTASUKIGAP', 'TA_CDLTHRUSTING', 'TA_CDLTRISTAR', 'TA_CDLUNIQUE3RIVER', 'TA_CDLUPSIDEGAP2CROWS', 'TA_CDLXSIDEGAP3METHODS', 'TA_CEIL', 'TA_CMO', 'TA_CORREL', 'TA_COS', 'TA_COSH', 'TA_DEMA', 'TA_DIV', 'TA_DX', 'TA_EMA', 'TA_EXP', 'TA_FLOOR', 'TA_HT_DCPERIOD', 'TA_HT_DCPHASE', 'TA_HT_PHASOR', 'TA_HT_SINE', 'TA_HT_TRENDLINE', 'TA_HT_TRENDMODE', 'TA_IMI', 'TA_KAMA', 'TA_LINEARREG', 'TA_LINEARREG_ANGLE', 'TA_LINEARREG_INTERCEPT', 'TA_LINEARREG_SLOPE', 'TA_LN', 'TA_LOG10', 'TA_MA', 'TA_MACD', 'TA_MACDEXT', 'TA_MACDFIX', 'TA_MAMA', 'TA_MAVP', 'TA_MAX', 'TA_MAXINDEX', 'TA_MEDPRICE', 'TA_MFI', 'TA_MIDPOINT', 'TA_MIDPRICE', 'TA_MIN', 'TA_MININDEX', 'TA_MINMAX', 'TA_MINMAXINDEX', 'TA_MINUS_DI', 'TA_MINUS_DM', 'TA_MOM', 'TA_MULT', 'TA_NATR', 'TA_OBV', 'TA_PLUS_DI', 'TA_PLUS_DM', 'TA_PPO', 'TA_ROC', 'TA_ROCP', 'TA_ROCR', 'TA_ROCR100', 'TA_RSI', 'TA_SAR', 'TA_SAREXT', 'TA_SIN', 'TA_SINH', 'TA_SMA', 'TA_SQRT', 'TA_STDDEV', 'TA_STOCH', 'TA_STOCHF', 'TA_STOCHRSI', 'TA_SUB', 'TA_SUM', 'TA_T3', 'TA_TAN', 'TA_TANH', 'TA_TEMA', 'TA_TRANGE', 'TA_TRIMA', 'TA_TRIX', 'TA_TSF', 'TA_TYPPRICE', 'TA_ULTOSC', 'TA_VAR', 'TA_WCLPRICE', 'TA_WILLR', 'TA_WMA', 'TC_FixedA', 'TC_FixedA2015', 'TC_FixedA2017', 'TC_TestStub', 'TC_Zero', 'TIME', 'TIMELINE', 'TIMELINEVOL', 'TR', 'TRACE', 'TURNOVER', 'TestOrderBroker', 'TimeDelta', 'TimeDelta_timedelta', 'TimeLineList', 'TimeLineRecord', 'TimeLine_to_df', 'TimeLine_to_np', 'TradeCostBase', 'TradeList_to_df', 'TradeList_to_np', 'TradeManager', 'TradeRecord', 'TradeRecordList', 'TradeRequest', 'TransList', 'TransList_to_df', 'TransList_to_np', 'TransRecord', 'UPNDAY', 'VALUE', 'VAR', 'VARP', 'VIGOR', 'VOL', 'WARN', 'WEAVE', 'WEEK', 'WINNER', 'WMA', 'YEAR', 'ZHBOND10', 'ZONGGUBEN', 'ZSCORE', 'active_device', 'add_class_logger_handler', 'backtest', 'batch_calculate_inds', 'broker', 'broker_easytrader', 'broker_mail', 'can_upgrade', 'capture_multiprocess_all_logger', 'class_logger', 'close_ostream_to_python', 'close_spend_time', 'combinate_ind', 'combinate_index', 'concat_to_df', 'constant', 'core', 'cpp', 'crtBrokerTM', 'crtOB', 'crtSEOptimal', 'crtTM', 'crt_pf_strategy', 'crt_sys_strategy', 'current_path', 'date', 'datetime', 'df_to_ind', 'dll_directory', 'extend', 'fetch_trial_license', 'find_optimal_system', 'find_optimal_system_multi', 'get_block', 'get_business_name', 'get_data_from_buffer_server', 'get_date_range', 'get_kdata', 'get_last_version', 'get_log_level', 'get_stock', 'get_system_part_enum', 'get_system_part_name', 'get_version', 'get_version_git', 'get_version_with_build', 'hikyuu_init', 'hku_benchmark', 'hku_catch', 'hku_check', 'hku_check_ignore', 'hku_check_throw', 'hku_debug', 'hku_debug_if', 'hku_error', 'hku_error_if', 'hku_fatal', 'hku_fatal_if', 'hku_info', 'hku_info_if', 'hku_logger', 'hku_to_async', 'hku_trace', 'hku_trace_if', 'hku_warn', 'hku_warn_if', 'in_interactive_session', 'in_ipython_frontend', 'indicator', 'indicator_getitem', 'indicator_iter', 'indicator_to_df', 'inner_analysis_sys_list', 'inner_combinate_ind_analysis', 'inner_combinate_ind_analysis_with_block', 'isinf', 'isnan', 'list_getitem', 'new_Query_init', 'new_path', 'np', 'old_Query_init', 'open_ostream_to_python', 'open_spend_time', 'os', 'pd', 'pickle', 'pyind', 'remove_license', 'roundDown', 'roundEx', 'roundUp', 'run_in_strategy', 'set_log_level', 'set_my_logger_file', 'set_python_in_interactive', 'set_python_in_jupyter', 'spend_time', 'start_data_server', 'start_spot_agent', 'stop_data_server', 'stop_spot_agent', 'sys', 'talib_wrap', 'time', 'timedelta', 'timeout', 'timezone', 'toPriceList', 'traceback', 'trade', 'tzinfo', 'util', 'view_license', 'with_trace']
|
|
602
|
+
__all__ = ['ABS', 'ACOS', 'AD', 'ADVANCE', 'AF_EqualWeight', 'AF_FixedWeight', 'AF_FixedWeightList', 'AF_MultiFactor', 'ALIGN', 'AMA', 'AMO', 'ASIN', 'ATAN', 'ATR', 'AVEDEV', 'AllocateFundsBase', 'BACKSET', 'BARSCOUNT', 'BARSLAST', 'BARSSINCE', 'BARSSINCEN', 'BASE_DIR', 'BETWEEN', 'BLOCKSETNUM', 'BUSINESS', 'Block', 'BlockInfoDriver', 'BorrowRecord', 'BrokerPositionRecord', 'CAPITAL', 'CEILING', 'CLOSE', 'CN_Bool', 'CN_OPLine', 'CONST', 'CONTEXT', 'CONTEXT_K', 'CORR', 'COS', 'COST', 'COUNT', 'CROSS', 'CVAL', 'CYCLE', 'C_AMO', 'C_CLOSE', 'C_HIGH', 'C_KDATA', 'C_LOW', 'C_OPEN', 'C_VOL', 'ConditionBase', 'Constant', 'CostRecord', 'DATE', 'DAY', 'DEBUG', 'DECLINE', 'DEVSQ', 'DIFF', 'DIRECT', 'DISCARD', 'DMA', 'DOWNNDAY', 'DROPNA', 'DataDriverFactory', 'Datetime', 'DatetimeList', 'DatetimeList_to_df', 'DatetimeList_to_np', 'Datetime_date', 'Datetime_datetime', 'Days', 'EMA', 'ERROR', 'EVERY', 'EV_Bool', 'EV_TwoLine', 'EXIST', 'EXP', 'EasyTraderOrderBroker', 'EnvironmentBase', 'FATAL', 'FILTER', 'FINANCE', 'FLOOR', 'FundsRecord', 'HHV', 'HHVBARS', 'HIGH', 'HKUCheckError', 'HKUException', 'HOUR', 'HSL', 'Hours', 'IC', 'ICIR', 'IF', 'INBLOCK', 'INDEXA', 'INDEXADV', 'INDEXC', 'INDEXDEC', 'INDEXH', 'INDEXL', 'INDEXO', 'INDEXV', 'INFO', 'INSUM', 'INTPART', 'IR', 'ISINF', 'ISINFA', 'ISLASTBAR', 'ISNA', 'IndParam', 'Indicator', 'IndicatorImp', 'JUMPDOWN', 'JUMPUP', 'KALMAN', 'KDATA', 'KDATA_PART', 'KDJ', 'KData', 'KDataDriver', 'KDataToHdf5Importer', 'KData_getitem', 'KData_iter', 'KData_to_df', 'KData_to_np', 'KRecord', 'KRecordList', 'LAST', 'LASTVALUE', 'LIUTONGPAN', 'LLV', 'LLVBARS', 'LN', 'LOG', 'LOG_LEVEL', 'LONGCROSS', 'LOW', 'LoanRecord', 'LoggingContext', 'MA', 'MACD', 'MAX', 'MAXYEAR', 'MDD', 'MF_EqualWeight', 'MF_ICIRWeight', 'MF_ICWeight', 'MF_Weight', 'MIN', 'MINUTE', 'MINYEAR', 'MM_FixedCapital', 'MM_FixedCapitalFunds', 'MM_FixedCount', 'MM_FixedCountTps', 'MM_FixedPercent', 'MM_FixedRisk', 'MM_FixedUnits', 'MM_Nothing', 'MM_WilliamsFixedRisk', 'MOD', 'MONTH', 'MRR', 'MailOrderBroker', 'MarketInfo', 'Microseconds', 'Milliseconds', 'Minutes', 'MoneyManagerBase', 'MultiFactorBase', 'NDAY', 'NOT', 'OFF', 'OPEN', 'OrderBrokerBase', 'OrderBrokerWrap', 'PF_Simple', 'PF_WithoutAF', 'PG_FixedHoldDays', 'PG_FixedPercent', 'PG_NoGoal', 'POS', 'POW', 'PRICELIST', 'Parameter', 'Parameter_items', 'Parameter_iter', 'Parameter_keys', 'Parameter_to_dict', 'Path', 'Performance', 'Performance_to_df', 'Portfolio', 'PositionList_to_df', 'PositionList_to_np', 'PositionRecord', 'PositionRecordList', 'ProfitGoalBase', 'Query', 'RANK', 'RECOVER_BACKWARD', 'RECOVER_EQUAL_BACKWARD', 'RECOVER_EQUAL_FORWARD', 'RECOVER_FORWARD', 'REF', 'REPLACE', 'RESULT', 'REVERSE', 'ROC', 'ROCP', 'ROCR', 'ROCR100', 'ROUND', 'ROUNDDOWN', 'ROUNDUP', 'RSI', 'SAFTYLOSS', 'SE_Fixed', 'SE_MaxFundsOptimal', 'SE_MultiFactor', 'SE_PerformanceOptimal', 'SE_Signal', 'SGN', 'SG_Add', 'SG_AllwaysBuy', 'SG_And', 'SG_Band', 'SG_Bool', 'SG_Buy', 'SG_Cross', 'SG_CrossGold', 'SG_Cycle', 'SG_Div', 'SG_Flex', 'SG_Mul', 'SG_OneSide', 'SG_Or', 'SG_Sell', 'SG_Single', 'SG_Single2', 'SG_Sub', 'SIN', 'SLICE', 'SLOPE', 'SMA', 'SPEARMAN', 'SP_FixedPercent', 'SP_FixedValue', 'SQRT', 'STD', 'STDEV', 'STDP', 'ST_FixedPercent', 'ST_Indicator', 'ST_Saftyloss', 'SUM', 'SUMBARS', 'SYS_Simple', 'SYS_WalkForward', 'ScoreRecord', 'ScoreRecordList', 'Seconds', 'SelectorBase', 'SignalBase', 'SlippageBase', 'SpotRecord', 'Stock', 'StockManager', 'StockTypeInfo', 'StockWeight', 'StockWeightList', 'StoplossBase', 'Strategy', 'StrategyContext', 'System', 'SystemPart', 'SystemWeight', 'SystemWeightList', 'TAN', 'TA_ACCBANDS', 'TA_ACOS', 'TA_AD', 'TA_ADD', 'TA_ADOSC', 'TA_ADX', 'TA_ADXR', 'TA_APO', 'TA_AROON', 'TA_AROONOSC', 'TA_ASIN', 'TA_ATAN', 'TA_ATR', 'TA_AVGDEV', 'TA_AVGPRICE', 'TA_BBANDS', 'TA_BETA', 'TA_BOP', 'TA_CCI', 'TA_CDL2CROWS', 'TA_CDL3BLACKCROWS', 'TA_CDL3INSIDE', 'TA_CDL3LINESTRIKE', 'TA_CDL3OUTSIDE', 'TA_CDL3STARSINSOUTH', 'TA_CDL3WHITESOLDIERS', 'TA_CDLABANDONEDBABY', 'TA_CDLADVANCEBLOCK', 'TA_CDLBELTHOLD', 'TA_CDLBREAKAWAY', 'TA_CDLCLOSINGMARUBOZU', 'TA_CDLCONCEALBABYSWALL', 'TA_CDLCOUNTERATTACK', 'TA_CDLDARKCLOUDCOVER', 'TA_CDLDOJI', 'TA_CDLDOJISTAR', 'TA_CDLDRAGONFLYDOJI', 'TA_CDLENGULFING', 'TA_CDLEVENINGDOJISTAR', 'TA_CDLEVENINGSTAR', 'TA_CDLGAPSIDESIDEWHITE', 'TA_CDLGRAVESTONEDOJI', 'TA_CDLHAMMER', 'TA_CDLHANGINGMAN', 'TA_CDLHARAMI', 'TA_CDLHARAMICROSS', 'TA_CDLHIGHWAVE', 'TA_CDLHIKKAKE', 'TA_CDLHIKKAKEMOD', 'TA_CDLHOMINGPIGEON', 'TA_CDLIDENTICAL3CROWS', 'TA_CDLINNECK', 'TA_CDLINVERTEDHAMMER', 'TA_CDLKICKING', 'TA_CDLKICKINGBYLENGTH', 'TA_CDLLADDERBOTTOM', 'TA_CDLLONGLEGGEDDOJI', 'TA_CDLLONGLINE', 'TA_CDLMARUBOZU', 'TA_CDLMATCHINGLOW', 'TA_CDLMATHOLD', 'TA_CDLMORNINGDOJISTAR', 'TA_CDLMORNINGSTAR', 'TA_CDLONNECK', 'TA_CDLPIERCING', 'TA_CDLRICKSHAWMAN', 'TA_CDLRISEFALL3METHODS', 'TA_CDLSEPARATINGLINES', 'TA_CDLSHOOTINGSTAR', 'TA_CDLSHORTLINE', 'TA_CDLSPINNINGTOP', 'TA_CDLSTALLEDPATTERN', 'TA_CDLSTICKSANDWICH', 'TA_CDLTAKURI', 'TA_CDLTASUKIGAP', 'TA_CDLTHRUSTING', 'TA_CDLTRISTAR', 'TA_CDLUNIQUE3RIVER', 'TA_CDLUPSIDEGAP2CROWS', 'TA_CDLXSIDEGAP3METHODS', 'TA_CEIL', 'TA_CMO', 'TA_CORREL', 'TA_COS', 'TA_COSH', 'TA_DEMA', 'TA_DIV', 'TA_DX', 'TA_EMA', 'TA_EXP', 'TA_FLOOR', 'TA_HT_DCPERIOD', 'TA_HT_DCPHASE', 'TA_HT_PHASOR', 'TA_HT_SINE', 'TA_HT_TRENDLINE', 'TA_HT_TRENDMODE', 'TA_IMI', 'TA_KAMA', 'TA_LINEARREG', 'TA_LINEARREG_ANGLE', 'TA_LINEARREG_INTERCEPT', 'TA_LINEARREG_SLOPE', 'TA_LN', 'TA_LOG10', 'TA_MA', 'TA_MACD', 'TA_MACDEXT', 'TA_MACDFIX', 'TA_MAMA', 'TA_MAVP', 'TA_MAX', 'TA_MAXINDEX', 'TA_MEDPRICE', 'TA_MFI', 'TA_MIDPOINT', 'TA_MIDPRICE', 'TA_MIN', 'TA_MININDEX', 'TA_MINMAX', 'TA_MINMAXINDEX', 'TA_MINUS_DI', 'TA_MINUS_DM', 'TA_MOM', 'TA_MULT', 'TA_NATR', 'TA_OBV', 'TA_PLUS_DI', 'TA_PLUS_DM', 'TA_PPO', 'TA_ROC', 'TA_ROCP', 'TA_ROCR', 'TA_ROCR100', 'TA_RSI', 'TA_SAR', 'TA_SAREXT', 'TA_SIN', 'TA_SINH', 'TA_SMA', 'TA_SQRT', 'TA_STDDEV', 'TA_STOCH', 'TA_STOCHF', 'TA_STOCHRSI', 'TA_SUB', 'TA_SUM', 'TA_T3', 'TA_TAN', 'TA_TANH', 'TA_TEMA', 'TA_TRANGE', 'TA_TRIMA', 'TA_TRIX', 'TA_TSF', 'TA_TYPPRICE', 'TA_ULTOSC', 'TA_VAR', 'TA_WCLPRICE', 'TA_WILLR', 'TA_WMA', 'TC_FixedA', 'TC_FixedA2015', 'TC_FixedA2017', 'TC_TestStub', 'TC_Zero', 'TIME', 'TIMELINE', 'TIMELINEVOL', 'TR', 'TRACE', 'TURNOVER', 'TestOrderBroker', 'TimeDelta', 'TimeDelta_timedelta', 'TimeLineList', 'TimeLineRecord', 'TimeLine_to_df', 'TimeLine_to_np', 'TradeCostBase', 'TradeList_to_df', 'TradeList_to_np', 'TradeManager', 'TradeRecord', 'TradeRecordList', 'TradeRequest', 'TransList', 'TransList_to_df', 'TransList_to_np', 'TransRecord', 'UPNDAY', 'VALUE', 'VAR', 'VARP', 'VIGOR', 'VOL', 'WARN', 'WEAVE', 'WEEK', 'WINNER', 'WITHDAY', 'WITHHALFYEAR', 'WITHHOUR', 'WITHHOUR2', 'WITHHOUR4', 'WITHKTYPE', 'WITHMIN', 'WITHMIN15', 'WITHMIN30', 'WITHMIN5', 'WITHMIN60', 'WITHMONTH', 'WITHQUARTER', 'WITHWEEK', 'WITHYEAR', 'WMA', 'YEAR', 'ZHBOND10', 'ZONGGUBEN', 'ZSCORE', 'active_device', 'add_class_logger_handler', 'backtest', 'batch_calculate_inds', 'broker', 'broker_easytrader', 'broker_mail', 'can_upgrade', 'capture_multiprocess_all_logger', 'class_logger', 'close_ostream_to_python', 'close_spend_time', 'combinate_ind', 'combinate_index', 'concat_to_df', 'constant', 'core', 'cpp', 'crtBrokerTM', 'crtOB', 'crtSEOptimal', 'crtTM', 'crt_pf_strategy', 'crt_sys_strategy', 'current_path', 'date', 'datetime', 'df_to_ind', 'dll_directory', 'extend', 'fetch_trial_license', 'find_optimal_system', 'find_optimal_system_multi', 'get_block', 'get_business_name', 'get_data_from_buffer_server', 'get_date_range', 'get_kdata', 'get_last_version', 'get_log_level', 'get_stock', 'get_system_part_enum', 'get_system_part_name', 'get_version', 'get_version_git', 'get_version_with_build', 'hikyuu_init', 'hku_benchmark', 'hku_catch', 'hku_check', 'hku_check_ignore', 'hku_check_throw', 'hku_debug', 'hku_debug_if', 'hku_error', 'hku_error_if', 'hku_fatal', 'hku_fatal_if', 'hku_info', 'hku_info_if', 'hku_logger', 'hku_to_async', 'hku_trace', 'hku_trace_if', 'hku_warn', 'hku_warn_if', 'in_interactive_session', 'in_ipython_frontend', 'indicator', 'indicator_getitem', 'indicator_iter', 'indicator_to_df', 'inner_analysis_sys_list', 'inner_combinate_ind_analysis', 'inner_combinate_ind_analysis_with_block', 'isinf', 'isnan', 'list_getitem', 'new_Query_init', 'new_path', 'np', 'old_Query_init', 'open_ostream_to_python', 'open_spend_time', 'os', 'pd', 'pickle', 'pyind', 'remove_license', 'roundDown', 'roundEx', 'roundUp', 'run_in_strategy', 'set_log_level', 'set_my_logger_file', 'set_python_in_interactive', 'set_python_in_jupyter', 'spend_time', 'start_data_server', 'start_spot_agent', 'stop_data_server', 'stop_spot_agent', 'sys', 'talib_wrap', 'time', 'timedelta', 'timeout', 'timezone', 'toPriceList', 'traceback', 'trade', 'tzinfo', 'util', 'view_license', 'with_trace']
|
|
587
603
|
AMO: hikyuu.cpp.core39.Indicator # value = Indicator{...
|
|
588
604
|
BASE_DIR: str = 'D:\\workspace\\hikyuu\\hikyuu'
|
|
589
605
|
CLOSE: hikyuu.cpp.core39.Indicator # value = Indicator{...
|
hikyuu/trade_manage/broker.py
CHANGED
|
@@ -46,7 +46,7 @@ class OrderBrokerWrap(OrderBrokerBase):
|
|
|
46
46
|
super(OrderBrokerWrap, self).__init__(name)
|
|
47
47
|
self._broker = broker
|
|
48
48
|
|
|
49
|
-
def _buy(self, datetime, market, code, price, num, stoploss, goal_price, part_from):
|
|
49
|
+
def _buy(self, datetime, market, code, price, num, stoploss, goal_price, part_from, remark=""):
|
|
50
50
|
"""
|
|
51
51
|
实现 OrderBrokerBase 的 _buy 接口
|
|
52
52
|
:param str market: 证券市场
|
|
@@ -54,11 +54,11 @@ class OrderBrokerWrap(OrderBrokerBase):
|
|
|
54
54
|
:param float price: 买入价格
|
|
55
55
|
:param int num: 买入数量
|
|
56
56
|
"""
|
|
57
|
-
self._broker.buy(market, code, price, num, stoploss, goal_price, part_from)
|
|
57
|
+
self._broker.buy(market, code, price, num, stoploss, goal_price, part_from, remark)
|
|
58
58
|
|
|
59
|
-
def _sell(self, datetime, market, code, price, num, stoploss, goal_price, part_from):
|
|
59
|
+
def _sell(self, datetime, market, code, price, num, stoploss, goal_price, part_from, remark=""):
|
|
60
60
|
"""实现 OrderBrokerBase 的 _sell 接口"""
|
|
61
|
-
self._broker.sell(market, code, price, num, stoploss, goal_price, part_from)
|
|
61
|
+
self._broker.sell(market, code, price, num, stoploss, goal_price, part_from, remark)
|
|
62
62
|
|
|
63
63
|
def _get_asset_info(self):
|
|
64
64
|
try:
|
|
@@ -77,11 +77,11 @@ class TestOrderBroker:
|
|
|
77
77
|
def __init__(self):
|
|
78
78
|
pass
|
|
79
79
|
|
|
80
|
-
def buy(self, market, code, price, num, stoploss, goal_price, part_from):
|
|
81
|
-
print(f"买入:{market}{code}, 价格: {price}, 数量: {num} 预期止损价: {stoploss}, 预期目标价: {goal_price}, 信号来源: {part_from}")
|
|
80
|
+
def buy(self, market, code, price, num, stoploss, goal_price, part_from, remark=""):
|
|
81
|
+
print(f"买入:{market}{code}, 价格: {price}, 数量: {num} 预期止损价: {stoploss}, 预期目标价: {goal_price}, 信号来源: {part_from}, 备注: {remark}")
|
|
82
82
|
|
|
83
|
-
def sell(self, market, code, price, num, stoploss, goal_price, part_from):
|
|
84
|
-
print(f"卖出:{market}{code}, 价格: {price}, 数量: {num}, 信号来源: {part_from}")
|
|
83
|
+
def sell(self, market, code, price, num, stoploss, goal_price, part_from, remark=""):
|
|
84
|
+
print(f"卖出:{market}{code}, 价格: {price}, 数量: {num}, 信号来源: {part_from}, 备注: {remark}")
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
def crtOB(broker, name="NO_NAME"):
|
hikyuu/trade_manage/broker.pyi
CHANGED
|
@@ -16,7 +16,7 @@ class OrderBrokerWrap(hikyuu.cpp.core39.OrderBrokerBase):
|
|
|
16
16
|
订单代理包装类,用户可以参考自定义自己的订单代理,加入额外的处理
|
|
17
17
|
|
|
18
18
|
"""
|
|
19
|
-
def _buy(self, datetime, market, code, price, num, stoploss, goal_price, part_from):
|
|
19
|
+
def _buy(self, datetime, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
22
|
实现 OrderBrokerBase 的 _buy 接口
|
|
@@ -28,7 +28,7 @@ class OrderBrokerWrap(hikyuu.cpp.core39.OrderBrokerBase):
|
|
|
28
28
|
"""
|
|
29
29
|
def _get_asset_info(self):
|
|
30
30
|
...
|
|
31
|
-
def _sell(self, datetime, market, code, price, num, stoploss, goal_price, part_from):
|
|
31
|
+
def _sell(self, datetime, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
|
|
32
32
|
"""
|
|
33
33
|
实现 OrderBrokerBase 的 _sell 接口
|
|
34
34
|
"""
|
|
@@ -38,9 +38,9 @@ class TestOrderBroker:
|
|
|
38
38
|
"""
|
|
39
39
|
def __init__(self):
|
|
40
40
|
...
|
|
41
|
-
def buy(self, market, code, price, num, stoploss, goal_price, part_from):
|
|
41
|
+
def buy(self, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
|
|
42
42
|
...
|
|
43
|
-
def sell(self, market, code, price, num, stoploss, goal_price, part_from):
|
|
43
|
+
def sell(self, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
|
|
44
44
|
...
|
|
45
45
|
def crtOB(broker, name = 'NO_NAME'):
|
|
46
46
|
"""
|
|
@@ -17,13 +17,13 @@ class EasyTraderOrderBroker:
|
|
|
17
17
|
self.user = user
|
|
18
18
|
self.buffer = {}
|
|
19
19
|
|
|
20
|
-
def buy(self, market, code, price, num, stoploss, goal_price, part_from):
|
|
20
|
+
def buy(self, market, code, price, num, stoploss, goal_price, part_from, remark=""):
|
|
21
21
|
# self.user.buy(code, price=price, amount=num)
|
|
22
22
|
market_code = f"{market}{code}"
|
|
23
23
|
print(f"计划买入:{market_code} {price} {num}")
|
|
24
24
|
self.buffer[market_code] = (num, stoploss, goal_price)
|
|
25
25
|
|
|
26
|
-
def sell(self, market, code, price, num, stoploss, goal_price, part_from):
|
|
26
|
+
def sell(self, market, code, price, num, stoploss, goal_price, part_from, remark=""):
|
|
27
27
|
# self.user.sell(code, price=price, amount=num)
|
|
28
28
|
market_code = f"{market}{code}"
|
|
29
29
|
print(f"计划卖出:{market_code} {price} {num}")
|
|
@@ -59,5 +59,5 @@ class EasyTraderOrderBroker:
|
|
|
59
59
|
number=v['可用余额'], stoploss=stoploss, goal_price=goal_price, cost_price=v['成本价']))
|
|
60
60
|
|
|
61
61
|
ret = dict(datetime=str(Datetime.now()), cash=cash, positions=positions)
|
|
62
|
-
print(ret)
|
|
62
|
+
# print(ret)
|
|
63
63
|
return ret
|
|
@@ -11,11 +11,11 @@ class EasyTraderOrderBroker:
|
|
|
11
11
|
"""
|
|
12
12
|
def __init__(self, user):
|
|
13
13
|
...
|
|
14
|
-
def buy(self, market, code, price, num, stoploss, goal_price, part_from):
|
|
14
|
+
def buy(self, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
|
|
15
15
|
...
|
|
16
16
|
def get_asset_info(self):
|
|
17
17
|
"""
|
|
18
18
|
以下只适用于华泰
|
|
19
19
|
"""
|
|
20
|
-
def sell(self, market, code, price, num, stoploss, goal_price, part_from):
|
|
20
|
+
def sell(self, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
|
|
21
21
|
...
|