hikyuu 2.6.8.4__py3-none-macosx_11_0_arm64.whl → 2.7.0.4__py3-none-macosx_11_0_arm64.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/.style.yapf +350 -0
- hikyuu/__init__.py +31 -17
- hikyuu/__init__.pyi +677 -655
- hikyuu/analysis/__init__.pyi +584 -563
- hikyuu/analysis/analysis.pyi +604 -585
- hikyuu/core.py +2 -0
- hikyuu/core.pyi +586 -565
- hikyuu/cpp/__init__.pyi +2 -2
- hikyuu/cpp/core310.pyi +493 -108
- hikyuu/cpp/core310.so +0 -0
- hikyuu/cpp/core311.pyi +493 -108
- hikyuu/cpp/core311.so +0 -0
- hikyuu/cpp/core312.pyi +493 -108
- hikyuu/cpp/core312.so +0 -0
- hikyuu/cpp/core313.pyi +493 -108
- hikyuu/cpp/core313.so +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/cpp/libboost_charconv-mt.dylib +0 -0
- hikyuu/cpp/libboost_chrono-mt.dylib +0 -0
- hikyuu/cpp/libboost_date_time-mt.dylib +0 -0
- hikyuu/cpp/libboost_serialization-mt.dylib +0 -0
- hikyuu/cpp/libboost_system-mt.dylib +0 -0
- hikyuu/cpp/libboost_thread-mt.dylib +0 -0
- hikyuu/cpp/libboost_wserialization-mt.dylib +0 -0
- hikyuu/cpp/libhikyuu.dylib +0 -0
- hikyuu/cpp/libsqlite3.dylib +0 -0
- hikyuu/data/clickhouse_upgrade/createdb.sql +105 -105
- hikyuu/data/common.py +3 -3
- hikyuu/data/common_clickhouse.py +1 -1
- hikyuu/data/download_block.py +351 -0
- hikyuu/data/em_block_to_clickhouse.py +26 -74
- hikyuu/data/em_block_to_mysql.py +25 -75
- hikyuu/data/em_block_to_sqlite.py +26 -78
- hikyuu/data/hku_config_template.py +3 -3
- hikyuu/data/pytdx_to_clickhouse.py +15 -11
- hikyuu/data/pytdx_to_h5.py +6 -2
- hikyuu/data/pytdx_to_mysql.py +5 -1
- hikyuu/data/pytdx_weight_to_clickhouse.py +1 -1
- hikyuu/data/pytdx_weight_to_mysql.py +1 -1
- hikyuu/data/pytdx_weight_to_sqlite.py +1 -1
- hikyuu/data/zh_bond10_to_clickhouse.py +1 -1
- hikyuu/draw/__init__.pyi +1 -1
- hikyuu/draw/drawplot/__init__.pyi +32 -37
- hikyuu/draw/drawplot/bokeh_draw.pyi +668 -659
- hikyuu/draw/drawplot/common.pyi +3 -4
- hikyuu/draw/drawplot/echarts_draw.pyi +615 -594
- hikyuu/draw/drawplot/matplotlib_draw.py +4 -74
- hikyuu/draw/drawplot/matplotlib_draw.pyi +889 -901
- hikyuu/draw/elder.pyi +19 -20
- hikyuu/draw/kaufman.pyi +18 -18
- hikyuu/draw/volume.pyi +10 -10
- hikyuu/examples/notebook/Demo/Demo1.ipynb +48 -33
- hikyuu/examples/notebook/LICENSE +20 -0
- hikyuu/extend.py +0 -7
- hikyuu/extend.pyi +615 -598
- hikyuu/fetcher/stock/zh_block_em.py +12 -40
- hikyuu/gui/HikyuuTDX.py +99 -31
- hikyuu/gui/data/CollectSpotThread.py +1 -1
- hikyuu/gui/data/EscapetimeThread.py +8 -14
- hikyuu/gui/data/ImportBlockInfoTask.py +3 -10
- hikyuu/gui/data/MainWindow.py +1196 -717
- hikyuu/gui/data/MainWindow.ui +2059 -0
- hikyuu/gui/data/SchedImportThread.py +2 -2
- hikyuu/gui/data/UsePytdxImportToH5Thread.py +3 -3
- hikyuu/gui/data/UseQmtImportToH5Thread.py +2 -2
- hikyuu/gui/data/UseTdxImportToH5Thread.py +3 -3
- hikyuu/gui/data/tool.py +32 -25
- hikyuu/gui/dataserver.py +5 -3
- hikyuu/gui/images/liandongxiaopu.png +0 -0
- hikyuu/hub.pyi +69 -67
- hikyuu/include/hikyuu/DataType.h +4 -16
- hikyuu/include/hikyuu/KData.h +6 -3
- hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +1 -1
- hikyuu/include/hikyuu/KDataSharedBufferImp.h +1 -1
- hikyuu/include/hikyuu/KQuery.h +2 -2
- hikyuu/include/hikyuu/Stock.h +4 -1
- hikyuu/include/hikyuu/StockManager.h +13 -3
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +8 -0
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +26 -1
- hikyuu/include/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/base_info/sqlite/SQLiteBaseInfoDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/block_info/mysql/MySQLBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/block_info/qianlong/QLBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/block_info/sqlite/SQLiteBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/kdata/DoNothingKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/cvs/KDataTempCsvDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.h +1 -1
- hikyuu/include/hikyuu/hikyuu.h +1 -1
- hikyuu/include/hikyuu/indicator/build_in.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/CYCLE.h +4 -4
- hikyuu/include/hikyuu/indicator/crt/HSL.h +2 -2
- hikyuu/include/hikyuu/indicator/crt/QUANTILE_TRUNC.h +30 -0
- hikyuu/include/hikyuu/indicator/crt/TURNOVER.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/ZSCORE.h +2 -2
- hikyuu/include/hikyuu/indicator/imp/IQuantileTrunc.h +25 -0
- hikyuu/include/hikyuu/misc.h +38 -0
- hikyuu/include/hikyuu/plugin/dataserver.h +2 -1
- hikyuu/include/hikyuu/plugin/device.h +10 -0
- hikyuu/include/hikyuu/plugin/extind.h +37 -0
- hikyuu/include/hikyuu/plugin/hkuextra.h +0 -18
- hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -2
- hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +2 -0
- hikyuu/include/hikyuu/plugin/interface/ExtendIndicatorsPluginInterface.h +12 -0
- hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +0 -14
- hikyuu/include/hikyuu/plugin/interface/plugins.h +3 -1
- hikyuu/include/hikyuu/python/pybind_utils.h +1 -8
- hikyuu/include/hikyuu/strategy/RunSystemInStrategy.h +3 -0
- hikyuu/include/hikyuu/trade_manage/Performance.h +4 -4
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +10 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +0 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +36 -3
- hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +125 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +125 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/build_in.h +3 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/buildin_norm.h +36 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/buildin_scfilter.h +51 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/GroupSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreLessOrEqualValueSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreNanSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/MinAmountPercentSCFilter.h +25 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/PriceSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/TopNSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/EqualWeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICIRMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/WeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormMinMax.h +23 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantile.h +28 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantileUniform.h +28 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormZScore.h +25 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/__init__.py +1 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/quantile_trunc.h +16 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/SimplePortfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/WithoutAFPortfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +49 -0
- hikyuu/include/hikyuu/trade_sys/selector/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor2.h +40 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +0 -3
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector2.h +49 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorValueSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/signal/imp/BandSignal2.h +0 -4
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorSignal.h +1 -1
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorValueSignal.h +4 -4
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/slippage/build_in.h +5 -1
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_LogNormal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_Normal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_TruncNormal.h +25 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_Uniform.h +23 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/LogNormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/NormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/TruncNormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/UniformSlippage.h +24 -0
- hikyuu/include/hikyuu/trade_sys/system/System.h +14 -1
- hikyuu/include/hikyuu/utilities/SpendTimer.h +17 -7
- hikyuu/include/hikyuu/utilities/arithmetic.h +55 -0
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLStatement.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteConnect.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteStatement.h +1 -1
- hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +4 -1
- hikyuu/include/hikyuu/version.h +5 -5
- hikyuu/matplotlibrc +349 -0
- hikyuu/plugin/libbacktest.dylib +0 -0
- hikyuu/plugin/libclickhousedriver.dylib +0 -0
- hikyuu/plugin/libdataserver.dylib +0 -0
- hikyuu/plugin/libdataserver_parquet.dylib +0 -0
- hikyuu/plugin/libdevice.dylib +0 -0
- hikyuu/plugin/libextind.dylib +0 -0
- hikyuu/plugin/libhkuextra.dylib +0 -0
- hikyuu/plugin/libimport2hdf5.dylib +0 -0
- hikyuu/plugin/libtmreport.dylib +0 -0
- hikyuu/trade_manage/__init__.pyi +599 -579
- hikyuu/trade_manage/broker.pyi +19 -18
- hikyuu/trade_manage/broker_easytrader.pyi +6 -4
- hikyuu/trade_manage/broker_mail.pyi +22 -24
- hikyuu/trade_manage/trade.py +0 -2
- hikyuu/trade_manage/trade.pyi +599 -579
- hikyuu/util/check.pyi +17 -15
- hikyuu/util/mylog.pyi +8 -7
- hikyuu/util/notebook.pyi +9 -11
- hikyuu/util/singleton.pyi +8 -6
- {hikyuu-2.6.8.4.dist-info → hikyuu-2.7.0.4.dist-info}/METADATA +35 -34
- {hikyuu-2.6.8.4.dist-info → hikyuu-2.7.0.4.dist-info}/RECORD +197 -165
- {hikyuu-2.6.8.4.dist-info → hikyuu-2.7.0.4.dist-info}/top_level.txt +2 -2
- hikyuu/data_driver/__init__.py +0 -49
- hikyuu/data_driver/jqdata_data_driver.py +0 -277
- hikyuu/data_driver/pytdx_data_driver.py +0 -292
- hikyuu/fetcher/stock/zh_stock_a_huatai.py +0 -51
- hikyuu/fetcher/stock/zh_stock_a_pytdx.py +0 -129
- hikyuu/gui/data/CollectToMemThread.py +0 -123
- hikyuu/gui/data/CollectToMySQLThread.py +0 -178
- hikyuu/gui/start_huatai_insight.py +0 -510
- hikyuu/include/hikyuu/views/arrow_common.h +0 -38
- hikyuu/include/hikyuu/views/arrow_views.h +0 -117
- hikyuu/tools/update_block_info.py +0 -168
- /hikyuu/include/hikyuu/{views → trade_sys/multifactor/filter}/__init__.py +0 -0
- {hikyuu-2.6.8.4.dist-info → hikyuu-2.7.0.4.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.8.4.dist-info → hikyuu-2.7.0.4.dist-info}/entry_points.txt +0 -0
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
#include "hikyuu/KData.h"
|
|
11
|
-
#include "
|
|
11
|
+
#include "ScoresFilterBase.h"
|
|
12
|
+
#include "buildin_norm.h"
|
|
12
13
|
|
|
13
14
|
namespace hku {
|
|
14
15
|
|
|
@@ -108,6 +109,9 @@ public:
|
|
|
108
109
|
ScoreRecordList getScores(const Datetime& date, size_t start, size_t end,
|
|
109
110
|
std::function<bool(const Datetime&, const ScoreRecord&)>&& filter);
|
|
110
111
|
|
|
112
|
+
ScoreRecordList getScores(const Datetime& date, size_t start, size_t end,
|
|
113
|
+
const ScoresFilterPtr& filter);
|
|
114
|
+
|
|
111
115
|
/** 获取所有截面数据,已按降序排列 */
|
|
112
116
|
const vector<ScoreRecordList>& getAllScores();
|
|
113
117
|
|
|
@@ -128,12 +132,29 @@ public:
|
|
|
128
132
|
Indicator getICIR(int ir_n, int ic_n = 0);
|
|
129
133
|
|
|
130
134
|
/**
|
|
131
|
-
*
|
|
135
|
+
* 获取所有处理过的原始因子值(归一化、标准化)。每次都会计算。
|
|
132
136
|
* @note 考虑到内存占用,该数据没有缓存,一般用与测试或者想查看处理过的原始因子值
|
|
133
137
|
* @return vector<IndicatorList> stks x inds
|
|
134
138
|
*/
|
|
135
139
|
vector<IndicatorList> getAllSrcFactors();
|
|
136
140
|
|
|
141
|
+
/**
|
|
142
|
+
* 设置因子标准化/归一化操作
|
|
143
|
+
* @param norm 标准化操作
|
|
144
|
+
*/
|
|
145
|
+
void setNormalize(NormPtr norm);
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 对指定名称的指标应用特定的标准化/归一化、行业中性化、风格因子中性化操作。
|
|
149
|
+
* @note 标准化操作、行业中性化、风格因子中性化彼此无关,可同时指定也可分开指定。
|
|
150
|
+
* @param name 指标名称
|
|
151
|
+
* @param norm 标准化操作
|
|
152
|
+
* @param category 指标所属板块类别(需要中性化指定)
|
|
153
|
+
* @param style_inds 指标风格列表
|
|
154
|
+
*/
|
|
155
|
+
void addSpecialNormalize(const string& name, NormalizePtr norm, const string& category = "",
|
|
156
|
+
const IndicatorList& style_inds = IndicatorList());
|
|
157
|
+
|
|
137
158
|
void reset();
|
|
138
159
|
|
|
139
160
|
typedef std::shared_ptr<MultiFactorBase> MultiFactorPtr;
|
|
@@ -154,7 +175,9 @@ private:
|
|
|
154
175
|
|
|
155
176
|
void initParam();
|
|
156
177
|
|
|
157
|
-
|
|
178
|
+
// 构造每个指标构造行业哑变量,以便进行行业中性化处理
|
|
179
|
+
unordered_map<string, PriceList> _buildDummyIndex();
|
|
180
|
+
|
|
158
181
|
void _buildIndex(); // 计算完成后创建截面索引
|
|
159
182
|
void _buildIndexDesc(); // 创建降序排列的索引
|
|
160
183
|
void _buildIndexAsc(); // 创建升序排列的索引
|
|
@@ -178,6 +201,12 @@ protected:
|
|
|
178
201
|
vector<ScoreRecordList> m_stk_factor_by_date;
|
|
179
202
|
Indicator m_ic;
|
|
180
203
|
|
|
204
|
+
NormPtr m_norm; // 全局标准化/归一化操作
|
|
205
|
+
unordered_map<string, NormPtr> m_special_norms; // 对特定指标执行特定的标准化操作
|
|
206
|
+
unordered_map<string, string> m_special_category; // 对特定指标执行行业中性化时指定的板块分类
|
|
207
|
+
unordered_map<string, IndicatorList>
|
|
208
|
+
m_special_style_inds; // 对特定指标执行风格因子中性化时指定的风格因子
|
|
209
|
+
|
|
181
210
|
private:
|
|
182
211
|
std::mutex m_mutex;
|
|
183
212
|
bool m_calculated{false};
|
|
@@ -197,6 +226,8 @@ private:
|
|
|
197
226
|
ar& BOOST_SERIALIZATION_NVP(m_ref_stk);
|
|
198
227
|
ar& BOOST_SERIALIZATION_NVP(m_query);
|
|
199
228
|
ar& BOOST_SERIALIZATION_NVP(m_ref_dates);
|
|
229
|
+
ar& BOOST_SERIALIZATION_NVP(m_special_norms);
|
|
230
|
+
ar& BOOST_SERIALIZATION_NVP(m_special_category);
|
|
200
231
|
// 以下不需要保存,加载后重新计算
|
|
201
232
|
// ar& BOOST_SERIALIZATION_NVP(m_stk_map);
|
|
202
233
|
// ar& BOOST_SERIALIZATION_NVP(m_all_factors);
|
|
@@ -215,6 +246,8 @@ private:
|
|
|
215
246
|
ar& BOOST_SERIALIZATION_NVP(m_ref_stk);
|
|
216
247
|
ar& BOOST_SERIALIZATION_NVP(m_query);
|
|
217
248
|
ar& BOOST_SERIALIZATION_NVP(m_ref_dates);
|
|
249
|
+
ar& BOOST_SERIALIZATION_NVP(m_special_norms);
|
|
250
|
+
ar& BOOST_SERIALIZATION_NVP(m_special_category);
|
|
218
251
|
// ar& BOOST_SERIALIZATION_NVP(m_stk_map);
|
|
219
252
|
// ar& BOOST_SERIALIZATION_NVP(m_all_factors);
|
|
220
253
|
// ar& BOOST_SERIALIZATION_NVP(m_date_index);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-03
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/utilities/Parameter.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 时间截面数据归一化基类
|
|
16
|
+
*/
|
|
17
|
+
class HKU_API NormalizeBase {
|
|
18
|
+
PARAMETER_SUPPORT_WITH_CHECK
|
|
19
|
+
|
|
20
|
+
public:
|
|
21
|
+
NormalizeBase() = default;
|
|
22
|
+
NormalizeBase(const string& name) : m_name(name) {}
|
|
23
|
+
|
|
24
|
+
NormalizeBase(const NormalizeBase& other) : m_params(other.m_params), m_name(other.m_name) {}
|
|
25
|
+
|
|
26
|
+
virtual ~NormalizeBase() = default;
|
|
27
|
+
|
|
28
|
+
/** 获取名称 */
|
|
29
|
+
const string& name() const {
|
|
30
|
+
return m_name;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** 设置名称 */
|
|
34
|
+
void name(const string& name) {
|
|
35
|
+
m_name = name;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
typedef std::shared_ptr<NormalizeBase> NormPtr;
|
|
39
|
+
NormPtr clone();
|
|
40
|
+
|
|
41
|
+
virtual NormPtr _clone() = 0;
|
|
42
|
+
|
|
43
|
+
virtual PriceList normalize(const PriceList& data) = 0;
|
|
44
|
+
|
|
45
|
+
protected:
|
|
46
|
+
virtual bool isPythonObject() const {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
protected:
|
|
51
|
+
string m_name;
|
|
52
|
+
|
|
53
|
+
//============================================
|
|
54
|
+
// 序列化支持
|
|
55
|
+
//============================================
|
|
56
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
57
|
+
private:
|
|
58
|
+
friend class boost::serialization::access;
|
|
59
|
+
template <class Archive>
|
|
60
|
+
void save(Archive& ar, const unsigned int version) const {
|
|
61
|
+
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
62
|
+
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
template <class Archive>
|
|
66
|
+
void load(Archive& ar, const unsigned int version) {
|
|
67
|
+
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
68
|
+
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
|
72
|
+
#endif /* HKU_SUPPORT_SERIALIZATION */
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
76
|
+
BOOST_SERIALIZATION_ASSUME_ABSTRACT(MultiFactorBase)
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
80
|
+
/**
|
|
81
|
+
* 对于没有私有变量的继承子类,可直接使用该宏定义序列化
|
|
82
|
+
* @code
|
|
83
|
+
* class Drived: public NormalizeBase {
|
|
84
|
+
* NORMALIZE_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
85
|
+
*
|
|
86
|
+
* public:
|
|
87
|
+
* Drived();
|
|
88
|
+
* ...
|
|
89
|
+
* };
|
|
90
|
+
* @endcode
|
|
91
|
+
* @ingroup MultiFactor
|
|
92
|
+
*/
|
|
93
|
+
#define NORMALIZE_NO_PRIVATE_MEMBER_SERIALIZATION \
|
|
94
|
+
private: \
|
|
95
|
+
friend class boost::serialization::access; \
|
|
96
|
+
template <class Archive> \
|
|
97
|
+
void serialize(Archive& ar, const unsigned int version) { \
|
|
98
|
+
ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(NormalizeBase); \
|
|
99
|
+
}
|
|
100
|
+
#else
|
|
101
|
+
#define NORMALIZE_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
102
|
+
#endif
|
|
103
|
+
|
|
104
|
+
typedef std::shared_ptr<NormalizeBase> NormPtr;
|
|
105
|
+
typedef std::shared_ptr<NormalizeBase> NormalizePtr;
|
|
106
|
+
|
|
107
|
+
#define NORMALIZE_IMP(classname) \
|
|
108
|
+
public: \
|
|
109
|
+
virtual NormalizePtr _clone() override { \
|
|
110
|
+
return std::make_shared<classname>(); \
|
|
111
|
+
} \
|
|
112
|
+
PriceList normalize(const PriceList& data) override;
|
|
113
|
+
|
|
114
|
+
HKU_API std::ostream& operator<<(std::ostream&, const NormalizeBase&);
|
|
115
|
+
HKU_API std::ostream& operator<<(std::ostream&, const NormalizePtr&);
|
|
116
|
+
|
|
117
|
+
} // namespace hku
|
|
118
|
+
|
|
119
|
+
#if FMT_VERSION >= 90000
|
|
120
|
+
template <>
|
|
121
|
+
struct fmt::formatter<hku::NormalizeBase> : ostream_formatter {};
|
|
122
|
+
|
|
123
|
+
template <>
|
|
124
|
+
struct fmt::formatter<hku::NormalizePtr> : ostream_formatter {};
|
|
125
|
+
#endif
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-13
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/trade_manage/TradeManagerBase.h"
|
|
11
|
+
#include "ScoreRecord.h"
|
|
12
|
+
|
|
13
|
+
namespace hku {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 评分过滤器
|
|
17
|
+
* @note 虽然直接使用 std::function 即可,但如果使用 python 函数会造成并行死锁
|
|
18
|
+
* @ingroup Selector
|
|
19
|
+
*/
|
|
20
|
+
class HKU_API ScoresFilterBase {
|
|
21
|
+
PARAMETER_SUPPORT_WITH_CHECK
|
|
22
|
+
friend HKU_API std::ostream& operator<<(std::ostream&, const ScoresFilterBase&);
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
ScoresFilterBase() = default;
|
|
26
|
+
ScoresFilterBase(const ScoresFilterBase&) = default;
|
|
27
|
+
ScoresFilterBase(const string& name) : m_name(name) {}
|
|
28
|
+
virtual ~ScoresFilterBase() = default;
|
|
29
|
+
|
|
30
|
+
const string& name() const {
|
|
31
|
+
return m_name;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void name(const string& name) {
|
|
35
|
+
m_name = name;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ScoreRecordList filter(const ScoreRecordList& scores, const Datetime& date,
|
|
39
|
+
const KQuery& query);
|
|
40
|
+
|
|
41
|
+
virtual ScoreRecordList _filter(const ScoreRecordList& scores, const Datetime& date,
|
|
42
|
+
const KQuery& query) = 0;
|
|
43
|
+
|
|
44
|
+
typedef std::shared_ptr<ScoresFilterBase> ScoresFilterPtr;
|
|
45
|
+
ScoresFilterPtr clone();
|
|
46
|
+
|
|
47
|
+
virtual ScoresFilterPtr _clone() = 0;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend HKU_API ScoresFilterPtr operator|(const ScoresFilterPtr& a, const ScoresFilterPtr& b);
|
|
51
|
+
|
|
52
|
+
protected:
|
|
53
|
+
virtual bool isPythonObject() const {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
protected:
|
|
58
|
+
string m_name;
|
|
59
|
+
ScoresFilterPtr m_child;
|
|
60
|
+
|
|
61
|
+
//============================================
|
|
62
|
+
// 序列化支持
|
|
63
|
+
//============================================
|
|
64
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
65
|
+
private:
|
|
66
|
+
friend class boost::serialization::access;
|
|
67
|
+
template <class Archive>
|
|
68
|
+
void save(Archive& ar, const unsigned int version) const {
|
|
69
|
+
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
70
|
+
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
71
|
+
ar& BOOST_SERIALIZATION_NVP(m_child);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
template <class Archive>
|
|
75
|
+
void load(Archive& ar, const unsigned int version) {
|
|
76
|
+
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
77
|
+
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
78
|
+
ar& BOOST_SERIALIZATION_NVP(m_child);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
|
82
|
+
#endif /* HKU_SUPPORT_SERIALIZATION */
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
86
|
+
BOOST_SERIALIZATION_ASSUME_ABSTRACT(ScoresFilterBase)
|
|
87
|
+
#endif
|
|
88
|
+
|
|
89
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
90
|
+
#define SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION \
|
|
91
|
+
private: \
|
|
92
|
+
friend class boost::serialization::access; \
|
|
93
|
+
template <class Archive> \
|
|
94
|
+
void serialize(Archive& ar, const unsigned int version) { \
|
|
95
|
+
ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(ScoresFilterBase); \
|
|
96
|
+
}
|
|
97
|
+
#else
|
|
98
|
+
#define SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
99
|
+
#endif
|
|
100
|
+
|
|
101
|
+
typedef std::shared_ptr<ScoresFilterBase> ScoresFilterPtr;
|
|
102
|
+
typedef std::shared_ptr<ScoresFilterBase> SCFilterPtr;
|
|
103
|
+
|
|
104
|
+
#define SCORESFILTER_IMP(classname) \
|
|
105
|
+
public: \
|
|
106
|
+
virtual ScoresFilterPtr _clone() override { \
|
|
107
|
+
return std::make_shared<classname>(); \
|
|
108
|
+
} \
|
|
109
|
+
virtual ScoreRecordList _filter(const ScoreRecordList& scores, const Datetime& date, \
|
|
110
|
+
const KQuery& query) override;
|
|
111
|
+
|
|
112
|
+
HKU_API std::ostream& operator<<(std::ostream&, const ScoresFilterBase&);
|
|
113
|
+
HKU_API std::ostream& operator<<(std::ostream&, const ScoresFilterPtr&);
|
|
114
|
+
|
|
115
|
+
HKU_API ScoresFilterPtr operator|(const ScoresFilterPtr& a, const ScoresFilterPtr& b);
|
|
116
|
+
|
|
117
|
+
} // namespace hku
|
|
118
|
+
|
|
119
|
+
#if FMT_VERSION >= 90000
|
|
120
|
+
template <>
|
|
121
|
+
struct fmt::formatter<hku::ScoresFilterBase> : ostream_formatter {};
|
|
122
|
+
|
|
123
|
+
template <>
|
|
124
|
+
struct fmt::formatter<hku::ScoresFilterPtr> : ostream_formatter {};
|
|
125
|
+
#endif
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-03
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "NormalizeBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ingroup MultiFactor
|
|
16
|
+
* @{
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
inline NormPtr NORM_NOTHING() {
|
|
20
|
+
return NormPtr();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 最小-最大标准化 */
|
|
24
|
+
NormPtr HKU_API NORM_MinMax();
|
|
25
|
+
|
|
26
|
+
/** 正态标准化 */
|
|
27
|
+
NormPtr HKU_API NORM_Zscore(bool outExtreme = false, double nsigma = 3.0, bool recursive = false);
|
|
28
|
+
|
|
29
|
+
/** 分位数分布标准化 */
|
|
30
|
+
NormPtr HKU_API NORM_Quantile(double quantile_min = 0.01, double quantile_max = 0.99);
|
|
31
|
+
|
|
32
|
+
/** 分位数均匀分布标准化 */
|
|
33
|
+
NormPtr HKU_API NORM_Quantile_Uniform(double quantile_min = 0.01, double quantile_max = 0.99);
|
|
34
|
+
|
|
35
|
+
/* @} */
|
|
36
|
+
} // namespace hku
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-13
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "ScoresFilterBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @ingroup MultiFactor
|
|
16
|
+
* @{
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
ScoresFilterPtr HKU_API SCFilter_IgnoreNan();
|
|
20
|
+
|
|
21
|
+
ScoresFilterPtr HKU_API SCFilter_LessOrEqualValue(double value = 0.0);
|
|
22
|
+
|
|
23
|
+
ScoresFilterPtr HKU_API SCFilter_TopN(int topn = 10);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 过滤掉成交金额在评分列表末尾百分比范围内的截面
|
|
27
|
+
* @note
|
|
28
|
+
* 和传入的截面评分列表顺序相关,如果是降序,过滤的是成交金额较小的系统评分记录;反之,则是金额较大的系统评分记录
|
|
29
|
+
* @param min_amount_percent_limit 最小成交金额百分比限制
|
|
30
|
+
* @return ScoresFilterPtr
|
|
31
|
+
*/
|
|
32
|
+
ScoresFilterPtr HKU_API SCFilter_AmountLimit(double min_amount_percent_limit = 0.1);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 筛选指定分组的截面
|
|
36
|
+
* @param group 分组数量
|
|
37
|
+
* @param group_index 分组索引,从0开始
|
|
38
|
+
* @return ScoresFilterPtr
|
|
39
|
+
*/
|
|
40
|
+
ScoresFilterPtr HKU_API SCFilter_Group(int group = 10, int group_index = 0);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 筛选指定价格范围 [min_price, max_price] 内的截面
|
|
44
|
+
* @param min_price 最低价格
|
|
45
|
+
* @param max_price 最高价格
|
|
46
|
+
* @return ScoresFilterPtr
|
|
47
|
+
*/
|
|
48
|
+
ScoresFilterPtr HKU_API SCFilter_Price(double min_price = 10., double max_price = 100000.);
|
|
49
|
+
|
|
50
|
+
/* @} */
|
|
51
|
+
} // namespace hku
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-13
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../ScoresFilterBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class HKU_API GroupSCFilter : public ScoresFilterBase {
|
|
15
|
+
SCORESFILTER_IMP(GroupSCFilter)
|
|
16
|
+
SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
GroupSCFilter();
|
|
20
|
+
virtual ~GroupSCFilter() override = default;
|
|
21
|
+
virtual void _checkParam(const string& name) const override;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
} // namespace hku
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-14
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../ScoresFilterBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class HKU_API IgnoreLessOrEqualValueSCFilter : public ScoresFilterBase {
|
|
15
|
+
SCORESFILTER_IMP(IgnoreLessOrEqualValueSCFilter)
|
|
16
|
+
SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
IgnoreLessOrEqualValueSCFilter();
|
|
20
|
+
virtual ~IgnoreLessOrEqualValueSCFilter() override = default;
|
|
21
|
+
virtual void _checkParam(const string& name) const override;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
} // namespace hku
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-14
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../ScoresFilterBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class HKU_API IgnoreNanSCFilter : public ScoresFilterBase {
|
|
15
|
+
SCORESFILTER_IMP(IgnoreNanSCFilter)
|
|
16
|
+
SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
IgnoreNanSCFilter();
|
|
20
|
+
virtual ~IgnoreNanSCFilter() override = default;
|
|
21
|
+
virtual void _checkParam(const string& name) const override;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
} // namespace hku
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-13
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../ScoresFilterBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class HKU_API MinAmountPercentSCFilter : public ScoresFilterBase {
|
|
15
|
+
SCORESFILTER_IMP(MinAmountPercentSCFilter)
|
|
16
|
+
SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
MinAmountPercentSCFilter();
|
|
20
|
+
virtual ~MinAmountPercentSCFilter() override = default;
|
|
21
|
+
|
|
22
|
+
virtual void _checkParam(const string& name) const override;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
} // namespace hku
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-13
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../ScoresFilterBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class HKU_API PriceSCFilter : public ScoresFilterBase {
|
|
15
|
+
SCORESFILTER_IMP(PriceSCFilter)
|
|
16
|
+
SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
PriceSCFilter();
|
|
20
|
+
virtual ~PriceSCFilter() override = default;
|
|
21
|
+
virtual void _checkParam(const string& name) const override;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
} // namespace hku
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-14
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../ScoresFilterBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class HKU_API TopNSCFilter : public ScoresFilterBase {
|
|
15
|
+
SCORESFILTER_IMP(TopNSCFilter)
|
|
16
|
+
SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
TopNSCFilter();
|
|
20
|
+
virtual ~TopNSCFilter() override = default;
|
|
21
|
+
virtual void _checkParam(const string& name) const override;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
} // namespace hku
|
|
@@ -20,7 +20,7 @@ public:
|
|
|
20
20
|
EqualWeightMultiFactor(const vector<Indicator>& inds, const StockList& stks,
|
|
21
21
|
const KQuery& query, const Stock& ref_stk, int ic_n, bool spearman,
|
|
22
22
|
int mode, bool save_all_factors);
|
|
23
|
-
virtual ~EqualWeightMultiFactor() = default;
|
|
23
|
+
virtual ~EqualWeightMultiFactor() override = default;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
} // namespace hku
|
|
@@ -20,7 +20,7 @@ public:
|
|
|
20
20
|
ICIRMultiFactor(const IndicatorList& inds, const StockList& stks, const KQuery& query,
|
|
21
21
|
const Stock& ref_stk, int ic_n, int ic_rolling_n, bool spearman, int mode,
|
|
22
22
|
bool save_all_factors);
|
|
23
|
-
virtual ~ICIRMultiFactor() = default;
|
|
23
|
+
virtual ~ICIRMultiFactor() override = default;
|
|
24
24
|
|
|
25
25
|
virtual void _checkParam(const string& name) const override;
|
|
26
26
|
};
|
|
@@ -20,7 +20,7 @@ public:
|
|
|
20
20
|
ICMultiFactor(const IndicatorList& inds, const StockList& stks, const KQuery& query,
|
|
21
21
|
const Stock& ref_stk, int ic_n, int ic_rolling_n, bool spearman, int mode,
|
|
22
22
|
bool save_all_factors);
|
|
23
|
-
virtual ~ICMultiFactor() = default;
|
|
23
|
+
virtual ~ICMultiFactor() override = default;
|
|
24
24
|
|
|
25
25
|
virtual void _checkParam(const string& name) const override;
|
|
26
26
|
};
|
|
@@ -22,7 +22,7 @@ public:
|
|
|
22
22
|
WeightMultiFactor(const vector<Indicator>& inds, const PriceList& weights,
|
|
23
23
|
const StockList& stks, const KQuery& query, const Stock& ref_stk, int ic_n,
|
|
24
24
|
bool spearman, int mode, bool save_all_factors);
|
|
25
|
-
virtual ~WeightMultiFactor() = default;
|
|
25
|
+
virtual ~WeightMultiFactor() override = default;
|
|
26
26
|
|
|
27
27
|
private:
|
|
28
28
|
PriceList m_weights; // 每个指标权重,与输入 inds 列表等长
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-03
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../NormalizeBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
class NormMinMax : public NormalizeBase {
|
|
15
|
+
NORMALIZE_IMP(NormMinMax)
|
|
16
|
+
NORMALIZE_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
NormMinMax();
|
|
20
|
+
virtual ~NormMinMax() override;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
} // namespace hku
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-03
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "../NormalizeBase.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* 分位数均匀分布标准化
|
|
16
|
+
*/
|
|
17
|
+
class NormQuantile : public NormalizeBase {
|
|
18
|
+
NORMALIZE_IMP(NormQuantile)
|
|
19
|
+
NORMALIZE_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
20
|
+
|
|
21
|
+
public:
|
|
22
|
+
NormQuantile();
|
|
23
|
+
NormQuantile(double quantile_min, double quantile_max);
|
|
24
|
+
virtual ~NormQuantile() override;
|
|
25
|
+
virtual void _checkParam(const string& name) const override;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
} // namespace hku
|