hikyuu 2.7.2__py3-none-win_amd64.whl → 2.7.5__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 +21 -7
- hikyuu/__init__.pyi +16 -14
- hikyuu/analysis/__init__.pyi +2 -0
- hikyuu/analysis/analysis.pyi +3 -1
- hikyuu/core.pyi +4 -2
- 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 +123 -62
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +123 -62
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +123 -62
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +123 -62
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/cpp/mimalloc-redirect.dll +0 -0
- hikyuu/cpp/mimalloc.dll +0 -0
- hikyuu/data/clickhouse_upgrade/0002.sql +9 -0
- hikyuu/data/common_mysql.py +1 -1
- hikyuu/data/em_block_to_mysql.py +16 -4
- hikyuu/data/em_block_to_sqlite.py +16 -4
- hikyuu/data/hku_config_template.py +21 -3
- hikyuu/data/mysql_upgrade/0030.sql +3 -0
- hikyuu/data/pytdx_to_h5.py +2 -2
- hikyuu/data/pytdx_to_mysql.py +5 -5
- hikyuu/data/sqlite_upgrade/0030.sql +5 -0
- hikyuu/data/tdx_to_clickhouse.py +2 -2
- hikyuu/data/tdx_to_h5.py +11 -11
- hikyuu/data/tdx_to_mysql.py +2 -2
- hikyuu/draw/__init__.pyi +1 -1
- hikyuu/draw/drawplot/bokeh_draw.pyi +8 -6
- hikyuu/draw/drawplot/echarts_draw.pyi +8 -6
- hikyuu/draw/drawplot/matplotlib_draw.py +19 -11
- hikyuu/draw/drawplot/matplotlib_draw.pyi +8 -6
- hikyuu/examples/notebook/001-overview.ipynb +112 -78
- hikyuu/examples/notebook/004-IndicatorOverview.ipynb +52 -65
- hikyuu/examples/notebook/006-TradeManager.ipynb +402 -291
- hikyuu/examples/notebook/008-Pickle.ipynb +25 -17
- hikyuu/examples/notebook/009-RealData.ipynb +36 -38
- hikyuu/examples/notebook/Demo/Demo2.ipynb +146 -116
- hikyuu/extend.pyi +5 -3
- hikyuu/gui/HikyuuTDX.py +20 -0
- hikyuu/gui/data/MainWindow.py +169 -133
- hikyuu/gui/data/UseTdxImportToH5Thread.py +4 -2
- hikyuu/gui/start_qmt.py +1 -1
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/Block.h +9 -9
- hikyuu/include/hikyuu/HistoryFinanceInfo.h +3 -3
- hikyuu/include/hikyuu/KData.h +51 -28
- hikyuu/include/hikyuu/KDataImp.h +12 -7
- hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +13 -7
- hikyuu/include/hikyuu/KDataSharedBufferImp.h +8 -6
- hikyuu/include/hikyuu/KQuery.h +11 -11
- hikyuu/include/hikyuu/KRecord.h +1 -1
- hikyuu/include/hikyuu/MarketInfo.h +10 -10
- hikyuu/include/hikyuu/Stock.h +30 -30
- hikyuu/include/hikyuu/StockManager.h +24 -12
- hikyuu/include/hikyuu/StockTypeInfo.h +9 -9
- hikyuu/include/hikyuu/StockWeight.h +9 -9
- hikyuu/include/hikyuu/TimeLineRecord.h +1 -1
- hikyuu/include/hikyuu/TransRecord.h +1 -1
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +6 -7
- hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +5 -1
- hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
- hikyuu/include/hikyuu/global/sysinfo.h +1 -1
- hikyuu/include/hikyuu/indicator/IndParam.h +1 -1
- hikyuu/include/hikyuu/indicator/Indicator.h +56 -27
- hikyuu/include/hikyuu/indicator/Indicator2InImp.h +0 -4
- hikyuu/include/hikyuu/indicator/IndicatorImp.h +146 -73
- hikyuu/include/hikyuu/indicator/crt/CONTEXT.h +11 -1
- hikyuu/include/hikyuu/indicator/crt/IC.h +19 -14
- hikyuu/include/hikyuu/indicator/crt/ICIR.h +4 -7
- hikyuu/include/hikyuu/indicator/imp/IAbs.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IAcos.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IAd.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/IAdvance.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/IAma.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/IAsin.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IAtan.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IAtr.h +2 -3
- hikyuu/include/hikyuu/indicator/imp/IBackset.h +2 -4
- hikyuu/include/hikyuu/indicator/imp/IBlockSetNum.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/ICeil.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IContext.h +0 -3
- hikyuu/include/hikyuu/indicator/imp/ICorr.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/ICos.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ICost.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/ICount.h +2 -1
- hikyuu/include/hikyuu/indicator/imp/ICval.h +1 -4
- hikyuu/include/hikyuu/indicator/imp/ICycle.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/IDecline.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/IDevsq.h +4 -1
- hikyuu/include/hikyuu/indicator/imp/IDiff.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IDma.h +2 -0
- hikyuu/include/hikyuu/indicator/imp/IDropna.h +0 -4
- hikyuu/include/hikyuu/indicator/imp/IEma.h +3 -1
- hikyuu/include/hikyuu/indicator/imp/IEvery.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IExist.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IExp.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IFilter.h +4 -5
- hikyuu/include/hikyuu/indicator/imp/IFinance.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/IFloor.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IHhvbars.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IHighLine.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IHsl.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/IIc.h +3 -6
- hikyuu/include/hikyuu/indicator/imp/IInBlock.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/IIntpart.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IIsInf.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IIsInfa.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IIsLastBar.h +0 -1
- hikyuu/include/hikyuu/indicator/imp/IIsNa.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IJumpDown.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IJumpUp.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IKData.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/ILiuTongPan.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/ILn.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ILog.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ILowLine.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/ILowLineBars.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IMa.h +6 -1
- hikyuu/include/hikyuu/indicator/imp/IMacd.h +2 -0
- hikyuu/include/hikyuu/indicator/imp/INot.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IPow.h +3 -1
- hikyuu/include/hikyuu/indicator/imp/IQuantileTrunc.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IRecover.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/IRef.h +3 -1
- hikyuu/include/hikyuu/indicator/imp/IResult.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IReverse.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IRoc.h +6 -1
- hikyuu/include/hikyuu/indicator/imp/IRocp.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IRocr.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IRocr100.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IRound.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IRoundDown.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IRoundUp.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ISaftyLoss.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ISign.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ISin.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ISlope.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/ISma.h +2 -0
- hikyuu/include/hikyuu/indicator/imp/ISpearman.h +3 -0
- hikyuu/include/hikyuu/indicator/imp/ISqrt.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/IStdev.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IStdp.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/ISum.h +6 -1
- hikyuu/include/hikyuu/indicator/imp/ITan.h +1 -0
- hikyuu/include/hikyuu/indicator/imp/ITime.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/ITimeLine.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/ITr.h +1 -2
- hikyuu/include/hikyuu/indicator/imp/IVar.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IVarp.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IVigor.h +0 -2
- hikyuu/include/hikyuu/indicator/imp/IWma.h +5 -1
- hikyuu/include/hikyuu/indicator/imp/IZongGuBen.h +1 -2
- hikyuu/include/hikyuu/indicator_talib/imp/TaAdosc.h +0 -2
- hikyuu/include/hikyuu/indicator_talib/imp/TaSar.h +0 -2
- hikyuu/include/hikyuu/indicator_talib/imp/TaSarext.h +0 -4
- hikyuu/include/hikyuu/indicator_talib/imp/TaStoch.h +0 -3
- hikyuu/include/hikyuu/indicator_talib/imp/TaStochf.h +0 -2
- hikyuu/include/hikyuu/indicator_talib/imp/TaUltosc.h +0 -2
- hikyuu/include/hikyuu/indicator_talib/imp/ta_defines.h +2 -4
- hikyuu/include/hikyuu/indicator_talib/imp/ta_imp.h +70 -90
- hikyuu/include/hikyuu/plugin/extind.h +3 -0
- hikyuu/include/hikyuu/plugin/hkuextra.h +2 -0
- hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +2 -0
- hikyuu/include/hikyuu/python/pybind_utils.h +22 -5
- hikyuu/include/hikyuu/trade_manage/TradeCostBase.h +5 -3
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +9 -3
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +8 -4
- hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +6 -3
- hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +23 -20
- hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +6 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_EqualWeight.h +3 -3
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICIRWeight.h +4 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICWeight.h +4 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_Weight.h +4 -4
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +16 -13
- hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +4 -3
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +12 -3
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor2.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector2.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/OptimalSelectorBase.h +0 -2
- hikyuu/include/hikyuu/trade_sys/selector/imp/optimal/PerformanceOptimalSelector.h +0 -4
- hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +5 -3
- hikyuu/include/hikyuu/trade_sys/system/System.h +6 -4
- hikyuu/include/hikyuu/utilities/LruCache.h +299 -0
- hikyuu/include/hikyuu/utilities/arithmetic.h +2 -2
- hikyuu/include/hikyuu/utilities/omp_macro.h +25 -0
- hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +5 -0
- hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +72 -19
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +0 -4
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +1 -4
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +286 -0
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/checkdata.dll +0 -0
- hikyuu/plugin/clickhousedriver.dll +0 -0
- hikyuu/plugin/dataserver.dll +0 -0
- hikyuu/plugin/dataserver_parquet.dll +0 -0
- hikyuu/plugin/device.dll +0 -0
- hikyuu/plugin/extind.dll +0 -0
- hikyuu/plugin/hkuextra.dll +0 -0
- hikyuu/plugin/import2ch.dll +0 -0
- hikyuu/plugin/import2hdf5.dll +0 -0
- hikyuu/plugin/import2mysql.dll +0 -0
- hikyuu/plugin/tmreport.dll +0 -0
- hikyuu/test/Indicator.py +1 -2
- hikyuu/trade_manage/__init__.pyi +7 -5
- hikyuu/trade_manage/trade.pyi +7 -5
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/METADATA +2 -13
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/RECORD +232 -225
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/WHEEL +1 -1
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/entry_points.txt +0 -0
- {hikyuu-2.7.2.dist-info → hikyuu-2.7.5.dist-info}/top_level.txt +0 -0
|
@@ -13,12 +13,10 @@ namespace hku {
|
|
|
13
13
|
|
|
14
14
|
class TaStochf : public IndicatorImp {
|
|
15
15
|
INDICATOR_IMP(TaStochf)
|
|
16
|
-
INDICATOR_NEED_CONTEXT
|
|
17
16
|
INDICATOR_IMP_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
18
17
|
|
|
19
18
|
public:
|
|
20
19
|
TaStochf();
|
|
21
|
-
explicit TaStochf(const KData&, int fastk_n, int fastd_n, int fastd_matype);
|
|
22
20
|
virtual ~TaStochf() = default;
|
|
23
21
|
virtual void _checkParam(const string& name) const override;
|
|
24
22
|
};
|
|
@@ -13,12 +13,10 @@ namespace hku {
|
|
|
13
13
|
|
|
14
14
|
class TaUltosc : public IndicatorImp {
|
|
15
15
|
INDICATOR_IMP(TaUltosc)
|
|
16
|
-
INDICATOR_NEED_CONTEXT
|
|
17
16
|
INDICATOR_IMP_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
18
17
|
|
|
19
18
|
public:
|
|
20
19
|
TaUltosc();
|
|
21
|
-
explicit TaUltosc(const KData&, int n1, int n2, int n3);
|
|
22
20
|
virtual ~TaUltosc() = default;
|
|
23
21
|
virtual void _checkParam(const string& name) const override;
|
|
24
22
|
};
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
|
|
23
23
|
#define TA_IN1_OUT_DYN_DEF(func) \
|
|
24
24
|
class Cls_##func : public IndicatorImp { \
|
|
25
|
-
|
|
25
|
+
INDICATOR_IMP(Cls_##func) \
|
|
26
|
+
INDICATOR_IMP_SUPPORT_DYNAMIC_CYCLE \
|
|
26
27
|
INDICATOR_IMP_NO_PRIVATE_MEMBER_SERIALIZATION \
|
|
27
28
|
\
|
|
28
29
|
public: \
|
|
@@ -56,7 +57,6 @@
|
|
|
56
57
|
#define TA_K_OUT_DEF(func) \
|
|
57
58
|
class Cls_##func : public IndicatorImp { \
|
|
58
59
|
INDICATOR_IMP(Cls_##func) \
|
|
59
|
-
INDICATOR_NEED_CONTEXT \
|
|
60
60
|
INDICATOR_IMP_NO_PRIVATE_MEMBER_SERIALIZATION \
|
|
61
61
|
public: \
|
|
62
62
|
Cls_##func(); \
|
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
#define TA_K_OUT_N_DEF(func) \
|
|
68
68
|
class Cls_##func : public IndicatorImp { \
|
|
69
69
|
INDICATOR_IMP(Cls_##func) \
|
|
70
|
-
INDICATOR_NEED_CONTEXT \
|
|
71
70
|
INDICATOR_IMP_NO_PRIVATE_MEMBER_SERIALIZATION \
|
|
72
71
|
public: \
|
|
73
72
|
Cls_##func(); \
|
|
@@ -79,7 +78,6 @@
|
|
|
79
78
|
#define TA_K_OUT_P_D_DEF(func) \
|
|
80
79
|
class Cls_##func : public IndicatorImp { \
|
|
81
80
|
INDICATOR_IMP(Cls_##func) \
|
|
82
|
-
INDICATOR_NEED_CONTEXT \
|
|
83
81
|
INDICATOR_IMP_NO_PRIVATE_MEMBER_SERIALIZATION \
|
|
84
82
|
public: \
|
|
85
83
|
Cls_##func(); \
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
\
|
|
114
114
|
void Cls_##func::_dyn_run_one_step(const Indicator &ind, size_t curPos, size_t step) { \
|
|
115
115
|
int back = func_lookback(step); \
|
|
116
|
-
HKU_IF_RETURN(back<0 || back + ind.discard()> curPos, void());
|
|
116
|
+
HKU_IF_RETURN(back < 0 || back + ind.discard() > curPos, void()); \
|
|
117
117
|
\
|
|
118
118
|
std::unique_ptr<double[]> buf = std::make_unique<double[]>(curPos); \
|
|
119
119
|
auto const *src = ind.data(); \
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
\
|
|
182
182
|
void Cls_##func::_dyn_run_one_step(const Indicator &ind, size_t curPos, size_t step) { \
|
|
183
183
|
int back = func_lookback(step); \
|
|
184
|
-
HKU_IF_RETURN(back<0 || back + ind.discard()> curPos, void());
|
|
184
|
+
HKU_IF_RETURN(back < 0 || back + ind.discard() > curPos, void()); \
|
|
185
185
|
\
|
|
186
186
|
std::unique_ptr<int[]> buf = std::make_unique<int[]>(curPos); \
|
|
187
187
|
auto const *src = ind.data(); \
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
\
|
|
284
284
|
void Cls_##func::_dyn_run_one_step(const Indicator &ind, size_t curPos, size_t step) { \
|
|
285
285
|
int back = func_lookback(step); \
|
|
286
|
-
HKU_IF_RETURN(back<0 || back + ind.discard()> curPos, void());
|
|
286
|
+
HKU_IF_RETURN(back < 0 || back + ind.discard() > curPos, void()); \
|
|
287
287
|
\
|
|
288
288
|
std::unique_ptr<int[]> buf = std::make_unique<int[]>(2 * curPos); \
|
|
289
289
|
int *buf0 = buf.get(); \
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
\
|
|
351
351
|
void Cls_##func::_dyn_run_one_step(const Indicator &ind, size_t curPos, size_t step) { \
|
|
352
352
|
int back = func_lookback(step); \
|
|
353
|
-
HKU_IF_RETURN(back<0 || back + ind.discard()> curPos, void());
|
|
353
|
+
HKU_IF_RETURN(back < 0 || back + ind.discard() > curPos, void()); \
|
|
354
354
|
\
|
|
355
355
|
std::unique_ptr<double[]> buf = std::make_unique<double[]>(2 * curPos); \
|
|
356
356
|
double *dst0 = buf.get(); \
|
|
@@ -418,7 +418,7 @@
|
|
|
418
418
|
\
|
|
419
419
|
void Cls_##func::_dyn_run_one_step(const Indicator &ind, size_t curPos, size_t step) { \
|
|
420
420
|
int back = func_lookback(step); \
|
|
421
|
-
HKU_IF_RETURN(back<0 || back + ind.discard()> curPos, void());
|
|
421
|
+
HKU_IF_RETURN(back < 0 || back + ind.discard() > curPos, void()); \
|
|
422
422
|
\
|
|
423
423
|
std::unique_ptr<double[]> buf = std::make_unique<double[]>(3 * curPos); \
|
|
424
424
|
double *dst0 = buf.get(); \
|
|
@@ -558,11 +558,8 @@
|
|
|
558
558
|
}
|
|
559
559
|
|
|
560
560
|
#define TA_OHLC_OUT1_IMP(func, func_lookback) \
|
|
561
|
-
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) {
|
|
562
|
-
|
|
563
|
-
Cls_##func::Cls_##func(const KData &k) : IndicatorImp(#func, 1) { \
|
|
564
|
-
setParam<KData>("kdata", k); \
|
|
565
|
-
Cls_##func::_calculate(Indicator()); \
|
|
561
|
+
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
562
|
+
m_need_context = true; \
|
|
566
563
|
} \
|
|
567
564
|
\
|
|
568
565
|
void Cls_##func::_calculate(const Indicator &data) { \
|
|
@@ -607,15 +604,14 @@
|
|
|
607
604
|
} \
|
|
608
605
|
\
|
|
609
606
|
Indicator HKU_API func(const KData &k) { \
|
|
610
|
-
|
|
607
|
+
auto p = make_shared<Cls_##func>(); \
|
|
608
|
+
p->setContext(k); \
|
|
609
|
+
return Indicator(p); \
|
|
611
610
|
}
|
|
612
611
|
|
|
613
612
|
#define TA_OHLC_OUT1_INT_IMP(func, func_lookback) \
|
|
614
|
-
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) {
|
|
615
|
-
|
|
616
|
-
Cls_##func::Cls_##func(const KData &k) : IndicatorImp(#func, 1) { \
|
|
617
|
-
setParam<KData>("kdata", k); \
|
|
618
|
-
Cls_##func::_calculate(Indicator()); \
|
|
613
|
+
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
614
|
+
m_need_context = true; \
|
|
619
615
|
} \
|
|
620
616
|
\
|
|
621
617
|
void Cls_##func::_calculate(const Indicator &data) { \
|
|
@@ -665,21 +661,18 @@
|
|
|
665
661
|
} \
|
|
666
662
|
\
|
|
667
663
|
Indicator HKU_API func(const KData &k) { \
|
|
668
|
-
|
|
664
|
+
auto p = make_shared<Cls_##func>(); \
|
|
665
|
+
p->setContext(k); \
|
|
666
|
+
return Indicator(p); \
|
|
669
667
|
}
|
|
670
668
|
|
|
671
669
|
#define TA_OHLC_OUT1_INT_P1_D_IMP(func, func_lookback, param1, param1_value, param1_min, \
|
|
672
670
|
param1_max) \
|
|
673
671
|
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
672
|
+
m_need_context = true; \
|
|
674
673
|
setParam<double>(#param1, param1_value); \
|
|
675
674
|
} \
|
|
676
675
|
\
|
|
677
|
-
Cls_##func::Cls_##func(const KData &k, double p) : IndicatorImp(#func, 1) { \
|
|
678
|
-
setParam<KData>("kdata", k); \
|
|
679
|
-
setParam<double>(#param1, p); \
|
|
680
|
-
Cls_##func::_calculate(Indicator()); \
|
|
681
|
-
} \
|
|
682
|
-
\
|
|
683
676
|
void Cls_##func::_checkParam(const string &name) const { \
|
|
684
677
|
if (name == #param1) { \
|
|
685
678
|
double p = getParam<double>(#param1); \
|
|
@@ -737,15 +730,15 @@
|
|
|
737
730
|
} \
|
|
738
731
|
\
|
|
739
732
|
Indicator HKU_API func(const KData &k, double p) { \
|
|
740
|
-
|
|
733
|
+
auto ptr = make_shared<Cls_##func>(); \
|
|
734
|
+
ptr->setParam<double>(#param1, p); \
|
|
735
|
+
ptr->setContext(k); \
|
|
736
|
+
return Indicator(ptr); \
|
|
741
737
|
}
|
|
742
738
|
|
|
743
739
|
#define TA_HLCV_OUT1_IMP(func, func_lookback) \
|
|
744
|
-
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) {
|
|
745
|
-
|
|
746
|
-
Cls_##func::Cls_##func(const KData &k) : IndicatorImp(#func, 1) { \
|
|
747
|
-
setParam<KData>("kdata", k); \
|
|
748
|
-
Cls_##func::_calculate(Indicator()); \
|
|
740
|
+
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
741
|
+
m_need_context = true; \
|
|
749
742
|
} \
|
|
750
743
|
\
|
|
751
744
|
void Cls_##func::_calculate(const Indicator &data) { \
|
|
@@ -790,15 +783,14 @@
|
|
|
790
783
|
} \
|
|
791
784
|
\
|
|
792
785
|
Indicator HKU_API func(const KData &k) { \
|
|
793
|
-
|
|
786
|
+
auto ptr = make_shared<Cls_##func>(); \
|
|
787
|
+
ptr->setContext(k); \
|
|
788
|
+
return Indicator(ptr); \
|
|
794
789
|
}
|
|
795
790
|
|
|
796
791
|
#define TA_HL_OUT1_IMP(func, func_lookback) \
|
|
797
|
-
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) {
|
|
798
|
-
|
|
799
|
-
Cls_##func::Cls_##func(const KData &k) : IndicatorImp(#func, 1) { \
|
|
800
|
-
setParam<KData>("kdata", k); \
|
|
801
|
-
Cls_##func::_calculate(Indicator()); \
|
|
792
|
+
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
793
|
+
m_need_context = true; \
|
|
802
794
|
} \
|
|
803
795
|
\
|
|
804
796
|
void Cls_##func::_calculate(const Indicator &data) { \
|
|
@@ -838,15 +830,14 @@
|
|
|
838
830
|
} \
|
|
839
831
|
\
|
|
840
832
|
Indicator HKU_API func(const KData &k) { \
|
|
841
|
-
|
|
833
|
+
auto ptr = make_shared<Cls_##func>(); \
|
|
834
|
+
ptr->setContext(k); \
|
|
835
|
+
return Indicator(ptr); \
|
|
842
836
|
}
|
|
843
837
|
|
|
844
838
|
#define TA_CV_OUT1_IMP(func, func_lookback) \
|
|
845
|
-
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) {
|
|
846
|
-
|
|
847
|
-
Cls_##func::Cls_##func(const KData &k) : IndicatorImp(#func, 1) { \
|
|
848
|
-
setParam<KData>("kdata", k); \
|
|
849
|
-
Cls_##func::_calculate(Indicator()); \
|
|
839
|
+
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
840
|
+
m_need_context = true; \
|
|
850
841
|
} \
|
|
851
842
|
\
|
|
852
843
|
void Cls_##func::_calculate(const Indicator &data) { \
|
|
@@ -886,15 +877,14 @@
|
|
|
886
877
|
} \
|
|
887
878
|
\
|
|
888
879
|
Indicator HKU_API func(const KData &k) { \
|
|
889
|
-
|
|
880
|
+
auto ptr = make_shared<Cls_##func>(); \
|
|
881
|
+
ptr->setContext(k); \
|
|
882
|
+
return Indicator(ptr); \
|
|
890
883
|
}
|
|
891
884
|
|
|
892
885
|
#define TA_HLC_OUT1_IMP(func, func_lookback) \
|
|
893
|
-
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) {
|
|
894
|
-
|
|
895
|
-
Cls_##func::Cls_##func(const KData &k) : IndicatorImp(#func, 1) { \
|
|
896
|
-
setParam<KData>("kdata", k); \
|
|
897
|
-
Cls_##func::_calculate(Indicator()); \
|
|
886
|
+
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
887
|
+
m_need_context = true; \
|
|
898
888
|
} \
|
|
899
889
|
\
|
|
900
890
|
void Cls_##func::_calculate(const Indicator &data) { \
|
|
@@ -936,20 +926,17 @@
|
|
|
936
926
|
} \
|
|
937
927
|
\
|
|
938
928
|
Indicator HKU_API func(const KData &k) { \
|
|
939
|
-
|
|
929
|
+
auto ptr = make_shared<Cls_##func>(); \
|
|
930
|
+
ptr->setContext(k); \
|
|
931
|
+
return Indicator(ptr); \
|
|
940
932
|
}
|
|
941
933
|
|
|
942
934
|
#define TA_HLC_OUT1_N_IMP(func, func_lookback, period, period_min, period_max) \
|
|
943
935
|
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
936
|
+
m_need_context = true; \
|
|
944
937
|
setParam<int>("n", period); \
|
|
945
938
|
} \
|
|
946
939
|
\
|
|
947
|
-
Cls_##func::Cls_##func(const KData &k, int n) : IndicatorImp(#func, 1) { \
|
|
948
|
-
setParam<KData>("kdata", k); \
|
|
949
|
-
setParam<int>("n", n); \
|
|
950
|
-
Cls_##func::_calculate(Indicator()); \
|
|
951
|
-
} \
|
|
952
|
-
\
|
|
953
940
|
void Cls_##func::_checkParam(const string &name) const { \
|
|
954
941
|
if (name == "n") { \
|
|
955
942
|
int n = getParam<int>("n"); \
|
|
@@ -1001,20 +988,18 @@
|
|
|
1001
988
|
} \
|
|
1002
989
|
\
|
|
1003
990
|
Indicator HKU_API func(const KData &k, int n) { \
|
|
1004
|
-
|
|
991
|
+
auto p = make_shared<Cls_##func>(); \
|
|
992
|
+
p->setParam<int>("n", n); \
|
|
993
|
+
p->setContext(k); \
|
|
994
|
+
return Indicator(p); \
|
|
1005
995
|
}
|
|
1006
996
|
|
|
1007
997
|
#define TA_HLCV_OUT1_N_IMP(func, func_lookback, period, period_min, period_max) \
|
|
1008
998
|
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
999
|
+
m_need_context = true; \
|
|
1009
1000
|
setParam<int>("n", period); \
|
|
1010
1001
|
} \
|
|
1011
1002
|
\
|
|
1012
|
-
Cls_##func::Cls_##func(const KData &k, int n) : IndicatorImp(#func, 1) { \
|
|
1013
|
-
setParam<KData>("kdata", k); \
|
|
1014
|
-
setParam<int>("n", n); \
|
|
1015
|
-
Cls_##func::_calculate(Indicator()); \
|
|
1016
|
-
} \
|
|
1017
|
-
\
|
|
1018
1003
|
void Cls_##func::_checkParam(const string &name) const { \
|
|
1019
1004
|
if (name == "n") { \
|
|
1020
1005
|
int n = getParam<int>("n"); \
|
|
@@ -1069,20 +1054,18 @@
|
|
|
1069
1054
|
} \
|
|
1070
1055
|
\
|
|
1071
1056
|
Indicator HKU_API func(const KData &k, int n) { \
|
|
1072
|
-
|
|
1057
|
+
auto p = make_shared<Cls_##func>(); \
|
|
1058
|
+
p->setParam<int>("n", n); \
|
|
1059
|
+
p->setContext(k); \
|
|
1060
|
+
return Indicator(p); \
|
|
1073
1061
|
}
|
|
1074
1062
|
|
|
1075
1063
|
#define TA_HL_OUT1_N_IMP(func, func_lookback, period, period_min, period_max) \
|
|
1076
1064
|
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
1065
|
+
m_need_context = true; \
|
|
1077
1066
|
setParam<int>("n", period); \
|
|
1078
1067
|
} \
|
|
1079
1068
|
\
|
|
1080
|
-
Cls_##func::Cls_##func(const KData &k, int n) : IndicatorImp(#func, 1) { \
|
|
1081
|
-
setParam<KData>("kdata", k); \
|
|
1082
|
-
setParam<int>("n", n); \
|
|
1083
|
-
Cls_##func::_calculate(Indicator()); \
|
|
1084
|
-
} \
|
|
1085
|
-
\
|
|
1086
1069
|
void Cls_##func::_checkParam(const string &name) const { \
|
|
1087
1070
|
if (name == "n") { \
|
|
1088
1071
|
int n = getParam<int>("n"); \
|
|
@@ -1131,20 +1114,18 @@
|
|
|
1131
1114
|
} \
|
|
1132
1115
|
\
|
|
1133
1116
|
Indicator HKU_API func(const KData &k, int n) { \
|
|
1134
|
-
|
|
1117
|
+
auto p = make_shared<Cls_##func>(); \
|
|
1118
|
+
p->setParam<int>("n", n); \
|
|
1119
|
+
p->setContext(k); \
|
|
1120
|
+
return Indicator(p); \
|
|
1135
1121
|
}
|
|
1136
1122
|
|
|
1137
1123
|
#define TA_HL_OUT2_N_IMP(func, func_lookback, period, period_min, period_max) \
|
|
1138
1124
|
Cls_##func::Cls_##func() : IndicatorImp(#func, 2) { \
|
|
1125
|
+
m_need_context = true; \
|
|
1139
1126
|
setParam<int>("n", period); \
|
|
1140
1127
|
} \
|
|
1141
1128
|
\
|
|
1142
|
-
Cls_##func::Cls_##func(const KData &k, int n) : IndicatorImp(#func, 2) { \
|
|
1143
|
-
setParam<KData>("kdata", k); \
|
|
1144
|
-
setParam<int>("n", n); \
|
|
1145
|
-
Cls_##func::_calculate(Indicator()); \
|
|
1146
|
-
} \
|
|
1147
|
-
\
|
|
1148
1129
|
void Cls_##func::_checkParam(const string &name) const { \
|
|
1149
1130
|
if (name == "n") { \
|
|
1150
1131
|
int n = getParam<int>("n"); \
|
|
@@ -1195,20 +1176,18 @@
|
|
|
1195
1176
|
} \
|
|
1196
1177
|
\
|
|
1197
1178
|
Indicator HKU_API func(const KData &k, int n) { \
|
|
1198
|
-
|
|
1179
|
+
auto p = make_shared<Cls_##func>(); \
|
|
1180
|
+
p->setParam<int>("n", n); \
|
|
1181
|
+
p->setContext(k); \
|
|
1182
|
+
return Indicator(p); \
|
|
1199
1183
|
}
|
|
1200
1184
|
|
|
1201
1185
|
#define TA_HLC_OUT3_N_IMP(func, func_lookback, period, period_min, period_max) \
|
|
1202
1186
|
Cls_##func::Cls_##func() : IndicatorImp(#func, 3) { \
|
|
1187
|
+
m_need_context = true; \
|
|
1203
1188
|
setParam<int>("n", period); \
|
|
1204
1189
|
} \
|
|
1205
1190
|
\
|
|
1206
|
-
Cls_##func::Cls_##func(const KData &k, int n) : IndicatorImp(#func, 3) { \
|
|
1207
|
-
setParam<KData>("kdata", k); \
|
|
1208
|
-
setParam<int>("n", n); \
|
|
1209
|
-
Cls_##func::_calculate(Indicator()); \
|
|
1210
|
-
} \
|
|
1211
|
-
\
|
|
1212
1191
|
void Cls_##func::_checkParam(const string &name) const { \
|
|
1213
1192
|
if (name == "n") { \
|
|
1214
1193
|
int n = getParam<int>("n"); \
|
|
@@ -1262,20 +1241,18 @@
|
|
|
1262
1241
|
} \
|
|
1263
1242
|
\
|
|
1264
1243
|
Indicator HKU_API func(const KData &k, int n) { \
|
|
1265
|
-
|
|
1244
|
+
auto p = make_shared<Cls_##func>(); \
|
|
1245
|
+
p->setParam<int>("n", n); \
|
|
1246
|
+
p->setContext(k); \
|
|
1247
|
+
return Indicator(p); \
|
|
1266
1248
|
}
|
|
1267
1249
|
|
|
1268
1250
|
#define TA_OC_OUT1_N_IMP(func, func_lookback, period, period_min, period_max) \
|
|
1269
1251
|
Cls_##func::Cls_##func() : IndicatorImp(#func, 1) { \
|
|
1252
|
+
m_need_context = true; \
|
|
1270
1253
|
setParam<int>("n", period); \
|
|
1271
1254
|
} \
|
|
1272
1255
|
\
|
|
1273
|
-
Cls_##func::Cls_##func(const KData &k, int n) : IndicatorImp(#func, 1) { \
|
|
1274
|
-
setParam<KData>("kdata", k); \
|
|
1275
|
-
setParam<int>("n", n); \
|
|
1276
|
-
Cls_##func::_calculate(Indicator()); \
|
|
1277
|
-
} \
|
|
1278
|
-
\
|
|
1279
1256
|
void Cls_##func::_checkParam(const string &name) const { \
|
|
1280
1257
|
if (name == "n") { \
|
|
1281
1258
|
int n = getParam<int>("n"); \
|
|
@@ -1324,5 +1301,8 @@
|
|
|
1324
1301
|
} \
|
|
1325
1302
|
\
|
|
1326
1303
|
Indicator HKU_API func(const KData &k, int n) { \
|
|
1327
|
-
|
|
1304
|
+
auto p = make_shared<Cls_##func>(); \
|
|
1305
|
+
p->setParam<int>("n", n); \
|
|
1306
|
+
p->setContext(k); \
|
|
1307
|
+
return Indicator(p); \
|
|
1328
1308
|
}
|
|
@@ -191,6 +191,9 @@ Indicator HKU_API AGG_VAR(const Indicator& ind, const KQuery::KType& ktype = KQu
|
|
|
191
191
|
Indicator HKU_API AGG_QUANTILE(const Indicator& ind, const KQuery::KType& ktype = KQuery::MIN,
|
|
192
192
|
bool fill_null = false, int unit = 1, double quantile = 0.75);
|
|
193
193
|
|
|
194
|
+
Indicator HKU_API AGG_VWAP(const KQuery::KType& ktype = KQuery::MIN, bool fill_null = false,
|
|
195
|
+
int unit = 1);
|
|
196
|
+
|
|
194
197
|
using agg_func_t = std::function<double(const DatetimeList& src_ds, const Indicator::value_t* src,
|
|
195
198
|
size_t group_start, size_t group_last)>;
|
|
196
199
|
Indicator HKU_API AGG_FUNC(const Indicator& ind, agg_func_t agg_func,
|
|
@@ -37,6 +37,8 @@ void HKU_API registerExtraKType(const string& ktype, const string& basetype, int
|
|
|
37
37
|
*/
|
|
38
38
|
void HKU_API releaseExtraKType();
|
|
39
39
|
|
|
40
|
+
void HKU_API enableKDataCache(bool enable);
|
|
41
|
+
|
|
40
42
|
//-------------------------------
|
|
41
43
|
// 以下函数为内部使用,无需引出
|
|
42
44
|
//-------------------------------
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#define HIKYUU_PYTHON_BIND_UTILS_H
|
|
11
11
|
|
|
12
12
|
#include <hikyuu/config.h>
|
|
13
|
+
#include <hikyuu/Stock.h>
|
|
13
14
|
#include <pybind11/pybind11.h>
|
|
14
15
|
|
|
15
16
|
#include <pybind11/operators.h>
|
|
@@ -100,11 +101,6 @@ public:
|
|
|
100
101
|
return std::shared_ptr<classname>(keep_python_state_alive, ptr); \
|
|
101
102
|
} \
|
|
102
103
|
return this->_clone(); \
|
|
103
|
-
} \
|
|
104
|
-
\
|
|
105
|
-
protected: \
|
|
106
|
-
inline bool isPythonObject() const override { \
|
|
107
|
-
return true; \
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
// 用于检查以 py::object 方式传递的函数参数个数是否符合预期
|
|
@@ -124,6 +120,27 @@ inline bool check_pyfunction_arg_num(const py::object& func, size_t arg_num) {
|
|
|
124
120
|
*/
|
|
125
121
|
size_t utf8_to_utf32(const std::string& utf8_str, int32_t* out, size_t out_len) noexcept;
|
|
126
122
|
|
|
123
|
+
// 从 python 对象获取 StockList 列表
|
|
124
|
+
inline StockList get_stock_list_from_python(const py::object& stks) {
|
|
125
|
+
StockList ret;
|
|
126
|
+
HKU_IF_RETURN(stks.is_none(), ret);
|
|
127
|
+
|
|
128
|
+
if (py::isinstance<StockList>(stks)) {
|
|
129
|
+
ret = stks.cast<StockList>();
|
|
130
|
+
} else if (py::isinstance<Block>(stks)) {
|
|
131
|
+
const auto& blk = stks.cast<Block&>();
|
|
132
|
+
ret = blk.getStockList();
|
|
133
|
+
} else if (py::isinstance<StockManager>(stks)) {
|
|
134
|
+
const auto& sm = stks.cast<StockManager&>();
|
|
135
|
+
ret = sm.getStockList();
|
|
136
|
+
} else if (py::isinstance<py::sequence>(stks)) {
|
|
137
|
+
ret = python_list_to_vector<Stock>(stks);
|
|
138
|
+
} else {
|
|
139
|
+
HKU_THROW("Failed get StockList! Input stks must be Block, sm or sequenc(Stock)!");
|
|
140
|
+
}
|
|
141
|
+
return ret;
|
|
142
|
+
}
|
|
143
|
+
|
|
127
144
|
} // namespace hku
|
|
128
145
|
|
|
129
146
|
#endif // HIKYUU_PYTHON_BIND_UTILS_H
|
|
@@ -107,12 +107,13 @@ public:
|
|
|
107
107
|
virtual TradeCostPtr _clone() = 0;
|
|
108
108
|
|
|
109
109
|
protected:
|
|
110
|
-
|
|
111
|
-
return
|
|
110
|
+
bool isPythonObject() const noexcept {
|
|
111
|
+
return m_is_python_object;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
protected:
|
|
115
115
|
string m_name;
|
|
116
|
+
bool m_is_python_object{false};
|
|
116
117
|
|
|
117
118
|
//============================================
|
|
118
119
|
// 序列化支持
|
|
@@ -123,6 +124,7 @@ private:
|
|
|
123
124
|
template <class Archive>
|
|
124
125
|
void serialize(Archive& ar, const unsigned int version) {
|
|
125
126
|
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
127
|
+
ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
|
|
126
128
|
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
127
129
|
}
|
|
128
130
|
#endif /* HKU_SUPPORT_SERIALIZATION */
|
|
@@ -37,6 +37,8 @@ class HKU_API TradeManagerBase : public enable_shared_from_this<TradeManagerBase
|
|
|
37
37
|
public:
|
|
38
38
|
TradeManagerBase() : TradeManagerBase("", TC_Zero()) {}
|
|
39
39
|
|
|
40
|
+
explicit TradeManagerBase(const string& name) : TradeManagerBase(name, TC_Zero()) {}
|
|
41
|
+
|
|
40
42
|
TradeManagerBase(const string& name, const TradeCostPtr& costFunc)
|
|
41
43
|
: m_name(name), m_costfunc(costFunc), m_broker_last_datetime(Datetime::now()) {
|
|
42
44
|
setParam<int>("precision", 2); // 计算精度
|
|
@@ -169,6 +171,7 @@ public:
|
|
|
169
171
|
HKU_CHECK(p, "Invalid ptr from _clone!");
|
|
170
172
|
p->m_params = m_params;
|
|
171
173
|
p->m_name = m_name;
|
|
174
|
+
p->m_is_python_object = m_is_python_object;
|
|
172
175
|
p->m_broker_last_datetime = m_broker_last_datetime;
|
|
173
176
|
p->m_costfunc = m_costfunc;
|
|
174
177
|
p->m_broker_list = m_broker_list;
|
|
@@ -769,9 +772,8 @@ public:
|
|
|
769
772
|
std::vector<std::pair<Datetime, double>> getProfitPercentYearly(
|
|
770
773
|
const Datetime& datetime = Datetime::now());
|
|
771
774
|
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
return false;
|
|
775
|
+
bool isPythonObject() const noexcept {
|
|
776
|
+
return m_is_python_object;
|
|
775
777
|
}
|
|
776
778
|
|
|
777
779
|
protected:
|
|
@@ -781,6 +783,8 @@ protected:
|
|
|
781
783
|
Datetime m_broker_last_datetime; // 订单代理最近一次执行操作的时刻,当前启动运行时间
|
|
782
784
|
list<OrderBrokerPtr> m_broker_list; // 订单代理列表
|
|
783
785
|
|
|
786
|
+
bool m_is_python_object{false};
|
|
787
|
+
|
|
784
788
|
//============================================
|
|
785
789
|
// 序列化支持
|
|
786
790
|
//============================================
|
|
@@ -794,6 +798,7 @@ private:
|
|
|
794
798
|
ar& BOOST_SERIALIZATION_NVP(m_costfunc);
|
|
795
799
|
ar& BOOST_SERIALIZATION_NVP(m_broker_last_datetime);
|
|
796
800
|
ar& BOOST_SERIALIZATION_NVP(m_broker_list);
|
|
801
|
+
ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
|
|
797
802
|
}
|
|
798
803
|
|
|
799
804
|
template <class Archive>
|
|
@@ -803,6 +808,7 @@ private:
|
|
|
803
808
|
ar& BOOST_SERIALIZATION_NVP(m_costfunc);
|
|
804
809
|
ar& BOOST_SERIALIZATION_NVP(m_broker_last_datetime);
|
|
805
810
|
ar& BOOST_SERIALIZATION_NVP(m_broker_list);
|
|
811
|
+
ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
|
|
806
812
|
}
|
|
807
813
|
|
|
808
814
|
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
|
@@ -101,9 +101,8 @@ public:
|
|
|
101
101
|
static void adjustWeight(SystemWeightList& sw_list, double can_allocate_weight,
|
|
102
102
|
bool auto_adjust, bool ignore_zero);
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return false;
|
|
104
|
+
bool isPythonObject() const noexcept {
|
|
105
|
+
return m_is_python_object;
|
|
107
106
|
}
|
|
108
107
|
|
|
109
108
|
private:
|
|
@@ -117,6 +116,9 @@ private:
|
|
|
117
116
|
void _adjust_without_running(const Datetime& date, const SystemWeightList& se_list,
|
|
118
117
|
const std::unordered_set<SYSPtr>& running_list);
|
|
119
118
|
|
|
119
|
+
protected:
|
|
120
|
+
bool m_is_python_object{false};
|
|
121
|
+
|
|
120
122
|
private:
|
|
121
123
|
string m_name; // 组件名称
|
|
122
124
|
KQuery m_query; // 查询条件
|
|
@@ -131,6 +133,7 @@ private:
|
|
|
131
133
|
friend class boost::serialization::access;
|
|
132
134
|
template <class Archive>
|
|
133
135
|
void save(Archive& ar, const unsigned int version) const {
|
|
136
|
+
ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
|
|
134
137
|
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
135
138
|
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
136
139
|
ar& BOOST_SERIALIZATION_NVP(m_query);
|
|
@@ -138,6 +141,7 @@ private:
|
|
|
138
141
|
|
|
139
142
|
template <class Archive>
|
|
140
143
|
void load(Archive& ar, const unsigned int version) {
|
|
144
|
+
ar& BOOST_SERIALIZATION_NVP(m_is_python_object);
|
|
141
145
|
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
142
146
|
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
143
147
|
ar& BOOST_SERIALIZATION_NVP(m_query);
|
|
@@ -148,7 +152,7 @@ private:
|
|
|
148
152
|
};
|
|
149
153
|
|
|
150
154
|
#if HKU_SUPPORT_SERIALIZATION
|
|
151
|
-
BOOST_SERIALIZATION_ASSUME_ABSTRACT(
|
|
155
|
+
BOOST_SERIALIZATION_ASSUME_ABSTRACT(AllocateFundsBase)
|
|
152
156
|
#endif
|
|
153
157
|
|
|
154
158
|
#if HKU_SUPPORT_SERIALIZATION
|