hikyuu 2.3.0__py3-none-win_amd64.whl → 2.5.0__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 +438 -6
- hikyuu/__init__.pyi +791 -0
- hikyuu/analysis/__init__.pyi +487 -0
- hikyuu/analysis/analysis.pyi +517 -0
- hikyuu/core.pyi +482 -0
- hikyuu/cpp/__init__.pyi +3 -0
- 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/core311.pyd +0 -0
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +12867 -0
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core38.pyd +0 -0
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/data/common_mysql.py +24 -7
- hikyuu/data/common_pytdx.py +17 -1
- hikyuu/data/em_block_to_mysql.py +3 -2
- hikyuu/data/em_block_to_sqlite.py +8 -3
- hikyuu/data/mysql_upgrade/0025.sql +61 -0
- hikyuu/data/mysql_upgrade/0026.sql +9 -0
- hikyuu/data/sqlite_upgrade/0025.sql +63 -0
- hikyuu/data/sqlite_upgrade/0026.sql +10 -0
- hikyuu/draw/__init__.pyi +35 -0
- hikyuu/draw/drawplot/__init__.py +3 -0
- hikyuu/draw/drawplot/__init__.pyi +134 -0
- hikyuu/draw/drawplot/bokeh_draw.pyi +796 -0
- hikyuu/draw/drawplot/common.pyi +10 -0
- hikyuu/draw/drawplot/echarts_draw.py +219 -24
- hikyuu/draw/drawplot/echarts_draw.pyi +682 -0
- hikyuu/draw/drawplot/matplotlib_draw.py +18 -3
- hikyuu/draw/drawplot/matplotlib_draw.pyi +1101 -0
- hikyuu/draw/elder.pyi +44 -0
- hikyuu/draw/kaufman.pyi +38 -0
- hikyuu/draw/volume.pyi +31 -0
- hikyuu/examples/notebook/Demo/Demo2.ipynb +1 -1
- hikyuu/extend.py +9 -3
- hikyuu/extend.pyi +636 -0
- hikyuu/fetcher/stock/zh_block_em.py +118 -51
- hikyuu/gui/data/EscapetimeThread.py +4 -4
- hikyuu/gui/data/ImportBlockInfoTask.py +3 -2
- hikyuu/gui/data/ImportHistoryFinanceTask.py +2 -0
- hikyuu/gui/data/MainWindow.py +48 -42
- hikyuu/gui/importdata.py +13 -26
- hikyuu/hub.py +2 -4
- hikyuu/hub.pyi +254 -0
- hikyuu/include/hikyuu/DataType.h +5 -0
- hikyuu/include/hikyuu/Stock.h +7 -0
- hikyuu/include/hikyuu/indicator/Indicator.h +8 -1
- hikyuu/include/hikyuu/indicator/Indicator2InImp.h +65 -0
- hikyuu/include/hikyuu/indicator/IndicatorImp.h +4 -3
- hikyuu/include/hikyuu/indicator/build_in.h +12 -0
- hikyuu/include/hikyuu/indicator/crt/ADVANCE.h +3 -1
- hikyuu/include/hikyuu/indicator/crt/CONTEXT.h +2 -2
- hikyuu/include/hikyuu/indicator/crt/CORR.h +4 -2
- hikyuu/include/hikyuu/indicator/crt/COST.h +3 -0
- hikyuu/include/hikyuu/indicator/crt/CYCLE.h +24 -0
- hikyuu/include/hikyuu/indicator/crt/DECLINE.h +3 -1
- hikyuu/include/hikyuu/indicator/crt/DISCARD.h +27 -0
- hikyuu/include/hikyuu/indicator/crt/DMA.h +2 -1
- hikyuu/include/hikyuu/indicator/crt/HSL.h +1 -13
- hikyuu/include/hikyuu/indicator/crt/INBLOCK.h +31 -0
- hikyuu/include/hikyuu/indicator/crt/INDEX.h +60 -0
- hikyuu/include/hikyuu/indicator/crt/INSUM.h +5 -2
- hikyuu/include/hikyuu/indicator/crt/ISINF.h +28 -0
- hikyuu/include/hikyuu/indicator/crt/ISINFA.h +28 -0
- hikyuu/include/hikyuu/indicator/crt/ISNA.h +29 -0
- hikyuu/include/hikyuu/indicator/crt/JUMPDOWN.h +24 -0
- hikyuu/include/hikyuu/indicator/crt/JUMPUP.h +24 -0
- hikyuu/include/hikyuu/indicator/crt/LASTVALUE.h +29 -0
- hikyuu/include/hikyuu/indicator/crt/LIUTONGPAN.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/REPLACE.h +29 -0
- hikyuu/include/hikyuu/indicator/crt/SPEARMAN.h +3 -2
- hikyuu/include/hikyuu/indicator/crt/WINNER.h +38 -0
- hikyuu/include/hikyuu/indicator/imp/IContext.h +1 -1
- hikyuu/include/hikyuu/indicator/imp/ICorr.h +7 -22
- hikyuu/include/hikyuu/indicator/imp/ICost.h +31 -0
- hikyuu/include/hikyuu/indicator/imp/ICycle.h +30 -0
- hikyuu/include/hikyuu/indicator/imp/IDiscard.h +28 -0
- hikyuu/include/hikyuu/indicator/imp/IDma.h +7 -24
- hikyuu/include/hikyuu/indicator/imp/IHsl.h +30 -0
- hikyuu/include/hikyuu/indicator/imp/IInBlock.h +30 -0
- hikyuu/include/hikyuu/indicator/imp/IIndex.h +26 -0
- hikyuu/include/hikyuu/indicator/imp/IIsInf.h +26 -0
- hikyuu/include/hikyuu/indicator/imp/IIsInfa.h +26 -0
- hikyuu/include/hikyuu/indicator/imp/IIsNa.h +26 -0
- hikyuu/include/hikyuu/indicator/imp/IJumpDown.h +24 -0
- hikyuu/include/hikyuu/indicator/imp/IJumpUp.h +24 -0
- hikyuu/include/hikyuu/indicator/imp/ILastValue.h +26 -0
- hikyuu/include/hikyuu/indicator/imp/IReplace.h +26 -0
- hikyuu/include/hikyuu/indicator/imp/ISpearman.h +6 -21
- hikyuu/include/hikyuu/indicator/imp/IWinner.h +26 -0
- hikyuu/include/hikyuu/indicator_talib/imp/TaMavp.h +6 -20
- hikyuu/include/hikyuu/indicator_talib/imp/ta_defines.h +14 -65
- hikyuu/include/hikyuu/indicator_talib/imp/ta_imp.h +54 -90
- hikyuu/include/hikyuu/indicator_talib/ta_crt.h +11 -9
- hikyuu/include/hikyuu/strategy/RunPortfolioInStrategy.h +3 -4
- hikyuu/include/hikyuu/strategy/Strategy.h +4 -5
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +5 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedWeightList.h +22 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixedWeightListAllocateFunds.h +25 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +17 -4
- hikyuu/include/hikyuu/trade_sys/moneymanager/build_in.h +2 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedCapital.h +6 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedCapitalFunds.h +26 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedCountTps.h +27 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedRisk.h +6 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_FixedUnits.h +6 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/crt/MM_WilliamsFixedRisk.h +7 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +28 -0
- hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCountTpsMM.h +44 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_Weight.h +30 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/WeightMultiFactor.h +41 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +38 -37
- hikyuu/include/hikyuu/trade_sys/portfolio/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/crt/PF_Simple.h +25 -1
- hikyuu/include/hikyuu/trade_sys/portfolio/crt/PF_WithoutAF.h +50 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/SimplePortfolio.h +53 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/WithoutAFPortfolio.h +57 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +7 -0
- hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +51 -5
- hikyuu/include/hikyuu/trade_sys/signal/build_in.h +2 -0
- hikyuu/include/hikyuu/trade_sys/signal/crt/SG_Bool.h +2 -1
- hikyuu/include/hikyuu/trade_sys/signal/crt/SG_Logic.h +37 -0
- hikyuu/include/hikyuu/trade_sys/signal/crt/SG_OneSide.h +28 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/OneSideSignal.h +46 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddSignal.h +19 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddValueSignal.h +19 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivSignal.h +19 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivValueSignal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulSignal.h +19 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulValueSignal.h +19 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorSignal.h +68 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorValueSignal.h +67 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubSignal.h +19 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubValueSignal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/__init__.py +1 -0
- hikyuu/include/hikyuu/trade_sys/stoploss/crt/ST_Indicator.h +1 -1
- hikyuu/include/hikyuu/trade_sys/stoploss/imp/IndicatorStoploss.h +3 -4
- hikyuu/include/hikyuu/utilities/FilterNode.h +2 -2
- hikyuu/include/hikyuu/utilities/Log.h +42 -15
- hikyuu/include/hikyuu/utilities/datetime/Datetime.h +1 -1
- hikyuu/include/hikyuu/utilities/datetime/TimeDelta.h +2 -2
- hikyuu/include/hikyuu/utilities/db_connect/DBCondition.h +4 -0
- hikyuu/include/hikyuu/utilities/db_connect/SQLResultSet.h +2 -2
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +5 -1
- hikyuu/include/hikyuu/utilities/node/NodeServer.h +4 -4
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +2 -2
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +2 -2
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +5 -5
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +2 -2
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +16 -10
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/indicator/indicator.py +1 -0
- hikyuu/interactive.py +3 -266
- hikyuu/trade_manage/__init__.pyi +584 -0
- hikyuu/trade_manage/broker.pyi +54 -0
- hikyuu/trade_manage/broker_easytrader.pyi +21 -0
- hikyuu/trade_manage/broker_mail.pyi +55 -0
- hikyuu/trade_manage/trade.pyi +590 -0
- hikyuu/util/__init__.pyi +55 -0
- hikyuu/util/check.pyi +59 -0
- hikyuu/util/mylog.pyi +70 -0
- hikyuu/util/notebook.pyi +23 -0
- hikyuu/util/singleton.pyi +18 -0
- hikyuu/util/slice.pyi +8 -0
- {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/METADATA +3 -2
- {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/RECORD +178 -95
- {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/top_level.txt +1 -0
- hikyuu/deprecated.py +0 -651
- {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/LICENSE +0 -0
- {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/WHEEL +0 -0
- {hikyuu-2.3.0.dist-info → hikyuu-2.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -249,10 +249,10 @@ public:
|
|
|
249
249
|
* @param data 事件附加信息
|
|
250
250
|
*/
|
|
251
251
|
void dispatch(const EventT& event, const any_t& data) {
|
|
252
|
-
m_tg->submit([
|
|
252
|
+
m_tg->submit([this, event, data] {
|
|
253
253
|
auto iter = m_trees.find(event);
|
|
254
254
|
HKU_WARN_IF_RETURN(iter == m_trees.end(), void(),
|
|
255
|
-
|
|
255
|
+
"There is no matching handling method for the event({})!", event);
|
|
256
256
|
iter->second->run(data);
|
|
257
257
|
});
|
|
258
258
|
}
|
|
@@ -344,14 +344,18 @@ std::shared_ptr<spdlog::logger> HKU_UTILS_API getHikyuuLogger();
|
|
|
344
344
|
|
|
345
345
|
/** 用于 catch (...) 中打印,减少编译后代码大小 */
|
|
346
346
|
extern std::string g_unknown_error_msg;
|
|
347
|
-
#define HKU_THROW_UNKNOWN HKU_THROW(g_unknown_error_msg);
|
|
348
|
-
#define HKU_TRACE_UNKNOWN HKU_TRACE(g_unknown_error_msg)
|
|
349
|
-
#define HKU_DEBUG_UNKNOWN HKU_DEBUG(g_unknown_error_msg)
|
|
350
|
-
#define HKU_INFO_UNKNOWN HKU_INFO(g_unknown_error_msg)
|
|
351
|
-
#define HKU_ERROR_UNKNOWN HKU_ERROR(g_unknown_error_msg)
|
|
352
|
-
#define HKU_FATAL_UNKNOWN HKU_FATAL(g_unknown_error_msg)
|
|
353
|
-
|
|
354
|
-
#if CPP_STANDARD >=
|
|
347
|
+
#define HKU_THROW_UNKNOWN HKU_THROW("{}", g_unknown_error_msg);
|
|
348
|
+
#define HKU_TRACE_UNKNOWN HKU_TRACE("{}", g_unknown_error_msg)
|
|
349
|
+
#define HKU_DEBUG_UNKNOWN HKU_DEBUG("{}", g_unknown_error_msg)
|
|
350
|
+
#define HKU_INFO_UNKNOWN HKU_INFO("{}", g_unknown_error_msg)
|
|
351
|
+
#define HKU_ERROR_UNKNOWN HKU_ERROR("{}", g_unknown_error_msg)
|
|
352
|
+
#define HKU_FATAL_UNKNOWN HKU_FATAL("{}", g_unknown_error_msg)
|
|
353
|
+
|
|
354
|
+
#if CPP_STANDARD >= CPP_STANDARD_20
|
|
355
|
+
#define CLASS_LOGGER_IMP(cls) \
|
|
356
|
+
protected: \
|
|
357
|
+
static constexpr const char* ms_logger = #cls;
|
|
358
|
+
#elif CPP_STANDARD >= CPP_STANDARD_17
|
|
355
359
|
#define CLASS_LOGGER_IMP(cls) \
|
|
356
360
|
protected: \
|
|
357
361
|
inline static const char* ms_logger = #cls;
|
|
@@ -396,13 +400,36 @@ protected: \
|
|
|
396
400
|
HKU_FATAL_IF_RETURN(expr, ret, fmt::format("[{}] {}", ms_logger, fmt::format(__VA_ARGS__)))
|
|
397
401
|
|
|
398
402
|
#define CLS_ASSERT HKU_ASSERT
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
#
|
|
405
|
-
|
|
403
|
+
|
|
404
|
+
#define CLS_CHECK(expr, ...) \
|
|
405
|
+
do { \
|
|
406
|
+
if (!(expr)) { \
|
|
407
|
+
throw hku::exception(fmt::format("[{}] CLS_CHECK({}) {} [{}] ({}:{})", ms_logger, \
|
|
408
|
+
#expr, fmt::format(__VA_ARGS__), HKU_FUNCTION, \
|
|
409
|
+
__FILE__, __LINE__)); \
|
|
410
|
+
} \
|
|
411
|
+
} while (0)
|
|
412
|
+
|
|
413
|
+
#define CLS_CHECK_THROW(expr, except, ...) \
|
|
414
|
+
do { \
|
|
415
|
+
if (!(expr)) { \
|
|
416
|
+
throw except(fmt::format("[{}] CLS_CHECK({}) {} [{}] ({}:{})", ms_logger, #expr, \
|
|
417
|
+
fmt::format(__VA_ARGS__), HKU_FUNCTION, __FILE__, __LINE__)); \
|
|
418
|
+
} \
|
|
419
|
+
} while (0)
|
|
420
|
+
|
|
421
|
+
#define CLS_THROW(...) \
|
|
422
|
+
do { \
|
|
423
|
+
throw hku::exception(fmt::format("[{}] EXCEPTION: {} [{}] ({}:{})", ms_logger, \
|
|
424
|
+
fmt::format(__VA_ARGS__), HKU_FUNCTION, __FILE__, \
|
|
425
|
+
__LINE__)); \
|
|
426
|
+
} while (0)
|
|
427
|
+
|
|
428
|
+
#define CLS_THROW_EXCEPTION(except, ...) \
|
|
429
|
+
do { \
|
|
430
|
+
throw except(fmt::format("[{}] EXCEPTION: {} [{}] ({}:{})", ms_logger, \
|
|
431
|
+
fmt::format(__VA_ARGS__), HKU_FUNCTION, __FILE__, __LINE__)); \
|
|
432
|
+
} while (0)
|
|
406
433
|
|
|
407
434
|
/** @} */
|
|
408
435
|
|
|
@@ -424,7 +424,7 @@ inline string to_string(const hku::Datetime &date) {
|
|
|
424
424
|
#if FMT_VERSION >= 90000
|
|
425
425
|
template <>
|
|
426
426
|
struct fmt::formatter<hku::Datetime> {
|
|
427
|
-
|
|
427
|
+
FMT_CONSTEXPR auto parse(format_parse_context &ctx) -> decltype(ctx.begin()) {
|
|
428
428
|
return ctx.end();
|
|
429
429
|
}
|
|
430
430
|
|
|
@@ -59,7 +59,7 @@ public:
|
|
|
59
59
|
explicit TimeDelta(bt::time_duration td);
|
|
60
60
|
|
|
61
61
|
/** 从字符串构造,格式:-1 days, hh:mm:ss.000000) */
|
|
62
|
-
explicit TimeDelta(const std::string&
|
|
62
|
+
explicit TimeDelta(const std::string &delta);
|
|
63
63
|
|
|
64
64
|
/** 赋值构造函数 */
|
|
65
65
|
TimeDelta(const TimeDelta &) = default;
|
|
@@ -329,7 +329,7 @@ inline string to_string(const hku::TimeDelta &delta) {
|
|
|
329
329
|
#if FMT_VERSION >= 90000
|
|
330
330
|
template <>
|
|
331
331
|
struct fmt::formatter<hku::TimeDelta> {
|
|
332
|
-
|
|
332
|
+
FMT_CONSTEXPR auto parse(format_parse_context &ctx) -> decltype(ctx.begin()) {
|
|
333
333
|
return ctx.end();
|
|
334
334
|
}
|
|
335
335
|
|
|
@@ -245,4 +245,8 @@ inline DBCondition operator==(const Field &field, const char *val) {
|
|
|
245
245
|
return DBCondition(fmt::format(R"(({}="{}"))", field.name, val));
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
inline DBCondition operator!=(const Field &field, const char *val) {
|
|
249
|
+
return DBCondition(fmt::format(R"(({}<>"{}"))", field.name, val));
|
|
250
|
+
}
|
|
251
|
+
|
|
248
252
|
} // namespace hku
|
|
@@ -154,7 +154,7 @@ private:
|
|
|
154
154
|
if (m_connect && page != m_current_page) {
|
|
155
155
|
m_buffer.clear();
|
|
156
156
|
m_connect->batchLoad(
|
|
157
|
-
m_buffer, fmt::format(m_sql_template, TableT::getTableName(), m_where,
|
|
157
|
+
m_buffer, fmt::format(fmt::runtime(m_sql_template), TableT::getTableName(), m_where,
|
|
158
158
|
m_orderby_inner, page_size, page * page_size, m_orderby_outer));
|
|
159
159
|
m_current_page = page;
|
|
160
160
|
}
|
|
@@ -179,7 +179,7 @@ private:
|
|
|
179
179
|
};
|
|
180
180
|
|
|
181
181
|
template <class TableT, size_t page_size>
|
|
182
|
-
class SQLResultSetIterator
|
|
182
|
+
class SQLResultSetIterator {
|
|
183
183
|
public:
|
|
184
184
|
using ResultSet = SQLResultSet<TableT, page_size>;
|
|
185
185
|
|
|
@@ -41,13 +41,17 @@ public:
|
|
|
41
41
|
virtual void commit() override;
|
|
42
42
|
virtual void rollback() noexcept override;
|
|
43
43
|
|
|
44
|
+
public:
|
|
45
|
+
MYSQL *getRawMYSQL() const noexcept {
|
|
46
|
+
return m_mysql;
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
private:
|
|
45
50
|
bool tryConnect() noexcept;
|
|
46
51
|
void connect();
|
|
47
52
|
void close();
|
|
48
53
|
|
|
49
54
|
private:
|
|
50
|
-
friend class MySQLStatement;
|
|
51
55
|
MYSQL *m_mysql;
|
|
52
56
|
};
|
|
53
57
|
|
|
@@ -203,11 +203,11 @@ private:
|
|
|
203
203
|
nng_ctx_send(work->ctx, work->aio);
|
|
204
204
|
|
|
205
205
|
} catch (const NodeNngError& e) {
|
|
206
|
-
CLS_FATAL(e.what());
|
|
206
|
+
CLS_FATAL("{}", e.what());
|
|
207
207
|
work->state = Work::FINISH;
|
|
208
208
|
|
|
209
209
|
} catch (const NodeError& e) {
|
|
210
|
-
CLS_ERROR(e.what());
|
|
210
|
+
CLS_ERROR("{}", e.what());
|
|
211
211
|
res["ret"] = e.errcode();
|
|
212
212
|
res["msg"] = e.what();
|
|
213
213
|
encodeMsg(msg, res);
|
|
@@ -216,7 +216,7 @@ private:
|
|
|
216
216
|
nng_ctx_send(work->ctx, work->aio);
|
|
217
217
|
|
|
218
218
|
} catch (const std::exception& e) {
|
|
219
|
-
CLS_ERROR(e.what());
|
|
219
|
+
CLS_ERROR("{}", e.what());
|
|
220
220
|
res["ret"] = NodeErrorCode::UNKNOWN_ERROR;
|
|
221
221
|
res["msg"] = e.what();
|
|
222
222
|
encodeMsg(msg, res);
|
|
@@ -226,7 +226,7 @@ private:
|
|
|
226
226
|
|
|
227
227
|
} catch (...) {
|
|
228
228
|
std::string errmsg = "Unknown error!";
|
|
229
|
-
CLS_ERROR(errmsg);
|
|
229
|
+
CLS_ERROR("{}", errmsg);
|
|
230
230
|
res["ret"] = NodeErrorCode::UNKNOWN_ERROR;
|
|
231
231
|
res["msg"] = errmsg;
|
|
232
232
|
nng_aio_set_msg(work->aio, msg);
|
|
@@ -104,12 +104,12 @@ public:
|
|
|
104
104
|
|
|
105
105
|
/** 向线程池提交任务 */
|
|
106
106
|
template <typename FunctionType>
|
|
107
|
-
|
|
107
|
+
auto submit(FunctionType f) {
|
|
108
108
|
if (m_thread_need_stop.isSet() || m_done) {
|
|
109
109
|
throw std::logic_error("You can't submit a task to the stopped MQStealThreadPool!");
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
typedef typename std::
|
|
112
|
+
typedef typename std::invoke_result<FunctionType>::type result_type;
|
|
113
113
|
std::packaged_task<result_type()> task(f);
|
|
114
114
|
task_handle<result_type> res(task.get_future());
|
|
115
115
|
|
|
@@ -104,12 +104,12 @@ public:
|
|
|
104
104
|
|
|
105
105
|
/** 向线程池提交任务 */
|
|
106
106
|
template <typename FunctionType>
|
|
107
|
-
|
|
107
|
+
auto submit(FunctionType f) {
|
|
108
108
|
if (m_thread_need_stop.isSet() || m_done) {
|
|
109
109
|
throw std::logic_error("You can't submit a task to the stopped MQThreadPool!");
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
typedef typename std::
|
|
112
|
+
typedef typename std::invoke_result<FunctionType>::type result_type;
|
|
113
113
|
std::packaged_task<result_type()> task(f);
|
|
114
114
|
task_handle<result_type> res(task.get_future());
|
|
115
115
|
|
|
@@ -107,12 +107,12 @@ public:
|
|
|
107
107
|
|
|
108
108
|
/** 向线程池提交任务 */
|
|
109
109
|
template <typename FunctionType>
|
|
110
|
-
|
|
110
|
+
auto submit(FunctionType f) {
|
|
111
111
|
if (m_thread_need_stop.isSet() || m_done) {
|
|
112
112
|
throw std::logic_error("You can't submit a task to the stopped StealThreadPool!!");
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
typedef typename std::
|
|
115
|
+
typedef typename std::invoke_result<FunctionType>::type result_type;
|
|
116
116
|
std::packaged_task<result_type()> task(f);
|
|
117
117
|
task_handle<result_type> res(task.get_future());
|
|
118
118
|
if (m_local_work_queue) {
|
|
@@ -241,8 +241,8 @@ private:
|
|
|
241
241
|
// 线程本地变量
|
|
242
242
|
#if CPP_STANDARD >= CPP_STANDARD_17
|
|
243
243
|
inline static thread_local WorkStealQueue* m_local_work_queue = nullptr; // 本地任务队列
|
|
244
|
-
inline static thread_local int m_index = -1;
|
|
245
|
-
inline static thread_local InterruptFlag m_thread_need_stop;
|
|
244
|
+
inline static thread_local int m_index = -1; // 在线程池中的序号
|
|
245
|
+
inline static thread_local InterruptFlag m_thread_need_stop; // 线程停止运行指示
|
|
246
246
|
#else
|
|
247
247
|
static thread_local WorkStealQueue* m_local_work_queue; // 本地任务队列
|
|
248
248
|
static thread_local int m_index; // 在线程池中的序号
|
|
@@ -280,7 +280,7 @@ private:
|
|
|
280
280
|
task();
|
|
281
281
|
} else {
|
|
282
282
|
std::unique_lock<std::mutex> lk(m_cv_mutex);
|
|
283
|
-
m_cv.wait(lk, [
|
|
283
|
+
m_cv.wait(lk, [this] { return this->m_done || !this->m_master_work_queue.empty(); });
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
|
|
@@ -93,11 +93,11 @@ public:
|
|
|
93
93
|
|
|
94
94
|
/** 向线程池提交任务 */
|
|
95
95
|
template <typename FunctionType>
|
|
96
|
-
|
|
96
|
+
auto submit(FunctionType f) {
|
|
97
97
|
if (m_thread_need_stop.isSet() || m_done) {
|
|
98
98
|
throw std::logic_error("You can't submit a task to the stopped task group!");
|
|
99
99
|
}
|
|
100
|
-
typedef typename std::
|
|
100
|
+
typedef typename std::invoke_result<FunctionType>::type result_type;
|
|
101
101
|
std::packaged_task<result_type()> task(f);
|
|
102
102
|
task_handle<result_type> res(task.get_future());
|
|
103
103
|
m_master_work_queue.push(std::move(task));
|
|
@@ -26,19 +26,25 @@ inline std::vector<range_t> parallelIndexRange(size_t start, size_t end) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
size_t total = end - start;
|
|
29
|
+
if (total == 0) {
|
|
30
|
+
return ret;
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
size_t cpu_num = std::thread::hardware_concurrency();
|
|
30
|
-
if (
|
|
34
|
+
if (cpu_num == 1) {
|
|
31
35
|
ret.emplace_back(start, end);
|
|
32
36
|
return ret;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
size_t per_num = total / cpu_num;
|
|
36
|
-
|
|
37
|
-
size_t
|
|
38
|
-
|
|
40
|
+
if (per_num > 0) {
|
|
41
|
+
for (size_t i = 0; i < cpu_num; i++) {
|
|
42
|
+
size_t first = i * per_num + start;
|
|
43
|
+
ret.emplace_back(first, first + per_num);
|
|
44
|
+
}
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
for (size_t i = per_num * cpu_num; i <
|
|
47
|
+
for (size_t i = per_num * cpu_num + start; i < end; i++) {
|
|
42
48
|
ret.emplace_back(i, i + 1);
|
|
43
49
|
}
|
|
44
50
|
|
|
@@ -64,11 +70,11 @@ template <typename FunctionType, class TaskGroup = MQStealThreadPool>
|
|
|
64
70
|
auto parallel_for_index(size_t start, size_t end, FunctionType f) {
|
|
65
71
|
auto ranges = parallelIndexRange(start, end);
|
|
66
72
|
TaskGroup tg;
|
|
67
|
-
std::vector<std::future<std::vector<typename std::
|
|
73
|
+
std::vector<std::future<std::vector<typename std::invoke_result<FunctionType, size_t>::type>>>
|
|
68
74
|
tasks;
|
|
69
75
|
for (size_t i = 0, total = ranges.size(); i < total; i++) {
|
|
70
76
|
tasks.emplace_back(tg.submit([func = f, range = ranges[i]]() {
|
|
71
|
-
std::vector<typename std::
|
|
77
|
+
std::vector<typename std::invoke_result<FunctionType, size_t>::type> one_ret;
|
|
72
78
|
for (size_t ix = range.first; ix < range.second; ix++) {
|
|
73
79
|
one_ret.emplace_back(func(ix));
|
|
74
80
|
}
|
|
@@ -76,7 +82,7 @@ auto parallel_for_index(size_t start, size_t end, FunctionType f) {
|
|
|
76
82
|
}));
|
|
77
83
|
}
|
|
78
84
|
|
|
79
|
-
std::vector<typename std::
|
|
85
|
+
std::vector<typename std::invoke_result<FunctionType, size_t>::type> ret;
|
|
80
86
|
for (auto& task : tasks) {
|
|
81
87
|
auto one = task.get();
|
|
82
88
|
for (auto&& value : one) {
|
|
@@ -91,12 +97,12 @@ template <typename FunctionType, class TaskGroup = MQStealThreadPool>
|
|
|
91
97
|
auto parallel_for_range(size_t start, size_t end, FunctionType f) {
|
|
92
98
|
auto ranges = parallelIndexRange(start, end);
|
|
93
99
|
TaskGroup tg;
|
|
94
|
-
std::vector<std::future<typename std::
|
|
100
|
+
std::vector<std::future<typename std::invoke_result<FunctionType, range_t>::type>> tasks;
|
|
95
101
|
for (size_t i = 0, total = ranges.size(); i < total; i++) {
|
|
96
102
|
tasks.emplace_back(tg.submit([func = f, range = ranges[i]]() { return func(range); }));
|
|
97
103
|
}
|
|
98
104
|
|
|
99
|
-
typename std::
|
|
105
|
+
typename std::invoke_result<FunctionType, range_t>::type ret;
|
|
100
106
|
for (auto& task : tasks) {
|
|
101
107
|
auto one = task.get();
|
|
102
108
|
for (auto&& value : one) {
|
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.
|
|
15
|
+
#define HKU_VERSION "2.5.0"
|
|
16
16
|
#define HKU_VERSION_MAJOR 2
|
|
17
|
-
#define HKU_VERSION_MINOR
|
|
17
|
+
#define HKU_VERSION_MINOR 5
|
|
18
18
|
#define HKU_VERSION_ALTER 0
|
|
19
|
-
#define HKU_VERSION_BUILD
|
|
19
|
+
#define HKU_VERSION_BUILD 202502201617
|
|
20
20
|
#define HKU_VERSION_MODE "RELEASE"
|
|
21
|
-
#define HKU_VERSION_GIT "2.
|
|
21
|
+
#define HKU_VERSION_GIT "2.5.0 release.77e90dd2 (RELEASE)"
|
|
22
22
|
// clang-format on
|
|
23
23
|
|
|
24
24
|
#endif /* HKU_VERSION_H */
|
hikyuu/indicator/indicator.py
CHANGED