hikyuu 2.6.8.3__py3-none-manylinux2014_aarch64.whl → 2.7.3__py3-none-manylinux2014_aarch64.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 +55 -23
- hikyuu/__init__.pyi +626 -595
- hikyuu/analysis/__init__.pyi +589 -563
- hikyuu/analysis/analysis.pyi +590 -564
- hikyuu/core.py +2 -0
- hikyuu/core.pyi +591 -565
- hikyuu/cpp/__init__.pyi +2 -2
- hikyuu/cpp/core310.pyi +587 -130
- hikyuu/cpp/core310.so +0 -0
- hikyuu/cpp/core311.pyi +587 -130
- hikyuu/cpp/core311.so +0 -0
- hikyuu/cpp/core312.pyi +587 -130
- hikyuu/cpp/core312.so +0 -0
- hikyuu/cpp/core313.pyi +587 -130
- hikyuu/cpp/core313.so +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu_plugin.mo +0 -0
- hikyuu/cpp/libboost_atomic.so +0 -0
- hikyuu/cpp/libboost_atomic.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_charconv.so +0 -0
- hikyuu/cpp/libboost_charconv.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_chrono.so +0 -0
- hikyuu/cpp/libboost_chrono.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_container.so +0 -0
- hikyuu/cpp/libboost_container.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_date_time.so +0 -0
- hikyuu/cpp/libboost_date_time.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_locale.so +0 -0
- hikyuu/cpp/libboost_locale.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_random.so +0 -0
- hikyuu/cpp/libboost_random.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_serialization.so +0 -0
- hikyuu/cpp/libboost_serialization.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_thread.so +0 -0
- hikyuu/cpp/libboost_thread.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_wserialization.so +0 -0
- hikyuu/cpp/libboost_wserialization.so.1.90.0 +0 -0
- hikyuu/cpp/libhikyuu.so +0 -0
- hikyuu/cpp/libhku_hdf5.so +0 -0
- hikyuu/cpp/libhku_hdf5.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5.so.200.2.0 +0 -0
- hikyuu/cpp/libhku_hdf5_cpp.so +0 -0
- hikyuu/cpp/libhku_hdf5_cpp.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_cpp.so.200.2.0 +0 -0
- hikyuu/cpp/libhku_hdf5_hl.so +0 -0
- hikyuu/cpp/libhku_hdf5_hl.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_hl.so.200.1.0 +0 -0
- hikyuu/cpp/libhku_hdf5_hl_cpp.so +0 -0
- hikyuu/cpp/libhku_hdf5_hl_cpp.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_hl_cpp.so.200.1.0 +0 -0
- hikyuu/cpp/libhku_hdf5_tools.so +0 -0
- hikyuu/cpp/libhku_hdf5_tools.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_tools.so.200.1.1 +0 -0
- hikyuu/cpp/libsqlite3.so +0 -0
- hikyuu/data/clickhouse_upgrade/0001.sql +2 -0
- hikyuu/data/clickhouse_upgrade/createdb.sql +105 -105
- hikyuu/data/common.py +3 -3
- hikyuu/data/common_clickhouse.py +1 -3
- 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 +33 -6
- hikyuu/data/mysql_upgrade/0029.sql +2 -0
- hikyuu/data/pytdx_to_clickhouse.py +96 -38
- hikyuu/data/pytdx_to_h5.py +78 -29
- hikyuu/data/pytdx_to_mysql.py +69 -21
- hikyuu/data/pytdx_weight_to_clickhouse.py +3 -1
- hikyuu/data/pytdx_weight_to_mysql.py +3 -1
- hikyuu/data/pytdx_weight_to_sqlite.py +3 -1
- hikyuu/data/sqlite_upgrade/0029.sql +4 -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/data/zh_bond10_to_clickhouse.py +1 -1
- hikyuu/draw/__init__.pyi +1 -1
- hikyuu/draw/drawplot/__init__.pyi +8 -8
- hikyuu/draw/drawplot/bokeh_draw.pyi +610 -583
- hikyuu/draw/drawplot/common.pyi +1 -1
- hikyuu/draw/drawplot/echarts_draw.pyi +612 -585
- hikyuu/draw/drawplot/matplotlib_draw.py +12 -76
- hikyuu/draw/drawplot/matplotlib_draw.pyi +623 -596
- hikyuu/draw/elder.pyi +11 -11
- hikyuu/draw/kaufman.pyi +18 -18
- hikyuu/draw/volume.pyi +10 -10
- hikyuu/examples/notebook/Demo/Demo1.ipynb +48 -33
- hikyuu/extend.py +0 -7
- hikyuu/extend.pyi +599 -573
- hikyuu/fetcher/stock/zh_block_em.py +12 -40
- hikyuu/gui/HikyuuTDX.py +140 -33
- 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 +1300 -761
- 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/gui/importdata.py +4 -0
- hikyuu/hub.pyi +6 -6
- 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 +29 -4
- hikyuu/include/hikyuu/StrategyContext.h +4 -4
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +9 -0
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +24 -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 +6 -2
- hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +2 -2
- hikyuu/include/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.h +1 -1
- hikyuu/include/hikyuu/global/sysinfo.h +24 -5
- hikyuu/include/hikyuu/hikyuu.h +1 -1
- hikyuu/include/hikyuu/indicator/IndicatorImp.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/lang.h +15 -2
- hikyuu/include/hikyuu/misc.h +38 -0
- hikyuu/include/hikyuu/plugin/KDataToClickHouseImporter.h +40 -0
- hikyuu/include/hikyuu/plugin/KDataToMySQLImporter.h +40 -0
- hikyuu/include/hikyuu/plugin/checkdata.h +20 -0
- hikyuu/include/hikyuu/plugin/dataserver.h +2 -1
- hikyuu/include/hikyuu/plugin/device.h +10 -0
- hikyuu/include/hikyuu/plugin/extind.h +40 -0
- hikyuu/include/hikyuu/plugin/hkuextra.h +1 -17
- hikyuu/include/hikyuu/plugin/interface/CheckDataPluginInterface.h +25 -0
- 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 +1 -13
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToClickHousePluginInterface.h +44 -0
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToMySQLPluginInterface.h +42 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +9 -1
- hikyuu/include/hikyuu/python/convert_any.h +9 -6
- hikyuu/include/hikyuu/python/pybind_utils.h +4 -11
- hikyuu/include/hikyuu/strategy/RunSystemInStrategy.h +3 -0
- hikyuu/include/hikyuu/strategy/Strategy.h +1 -1
- hikyuu/include/hikyuu/trade_manage/Performance.h +4 -4
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +10 -2
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +2 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedAmount.h +26 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixAmountFunds.h +18 -0
- hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +0 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +36 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +124 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +124 -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 +20 -13
- 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/profitgoal/ProfitGoalBase.h +9 -11
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +49 -1
- 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/SignalBase.h +0 -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/SlippageBase.h +0 -1
- 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/stoploss/StoplossBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/system/System.h +15 -3
- hikyuu/include/hikyuu/utilities/Log.h +6 -7
- hikyuu/include/hikyuu/utilities/Parameter.h +17 -0
- hikyuu/include/hikyuu/utilities/SpendTimer.h +17 -7
- hikyuu/include/hikyuu/utilities/arithmetic.h +55 -0
- hikyuu/include/hikyuu/utilities/config.h +28 -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/PluginBase.h +17 -2
- hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +4 -1
- hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +41 -22
- hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +1 -2
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -1
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +286 -0
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +297 -0
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/WorkStealQueue.h +9 -8
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +64 -14
- hikyuu/include/hikyuu/version.h +5 -5
- hikyuu/plugin/libbacktest.so +0 -0
- hikyuu/plugin/libcheckdata.so +0 -0
- hikyuu/plugin/libclickhousedriver.so +0 -0
- hikyuu/plugin/libdataserver.so +0 -0
- hikyuu/{cpp/core39.so → plugin/libdataserver_parquet.so} +0 -0
- hikyuu/plugin/libdevice.so +0 -0
- hikyuu/plugin/libextind.so +0 -0
- hikyuu/plugin/libhkuextra.so +0 -0
- hikyuu/plugin/libimport2ch.so +0 -0
- hikyuu/plugin/libimport2hdf5.so +0 -0
- hikyuu/plugin/libimport2mysql.so +0 -0
- hikyuu/plugin/libtmreport.so +0 -0
- hikyuu/trade_manage/__init__.pyi +607 -582
- hikyuu/trade_manage/broker.pyi +3 -3
- hikyuu/trade_manage/broker_easytrader.pyi +1 -1
- hikyuu/trade_manage/trade.py +0 -2
- hikyuu/trade_manage/trade.pyi +607 -582
- hikyuu/trade_sys/trade_sys.py +54 -5
- hikyuu/util/__init__.pyi +2 -2
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/METADATA +42 -32
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/RECORD +267 -212
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/top_level.txt +2 -2
- hikyuu/cpp/core39.pyi +0 -14190
- hikyuu/data/pytdx_to_taos.py +0 -736
- 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.3.dist-info → hikyuu-2.7.3.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
virtual bool isPythonObject() const {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
protected:
|
|
57
|
+
string m_name;
|
|
58
|
+
ScoresFilterPtr m_child;
|
|
59
|
+
|
|
60
|
+
//============================================
|
|
61
|
+
// 序列化支持
|
|
62
|
+
//============================================
|
|
63
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
64
|
+
private:
|
|
65
|
+
friend class boost::serialization::access;
|
|
66
|
+
template <class Archive>
|
|
67
|
+
void save(Archive& ar, const unsigned int version) const {
|
|
68
|
+
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
69
|
+
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
70
|
+
ar& BOOST_SERIALIZATION_NVP(m_child);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
template <class Archive>
|
|
74
|
+
void load(Archive& ar, const unsigned int version) {
|
|
75
|
+
ar& BOOST_SERIALIZATION_NVP(m_name);
|
|
76
|
+
ar& BOOST_SERIALIZATION_NVP(m_params);
|
|
77
|
+
ar& BOOST_SERIALIZATION_NVP(m_child);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
|
81
|
+
#endif /* HKU_SUPPORT_SERIALIZATION */
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
85
|
+
BOOST_SERIALIZATION_ASSUME_ABSTRACT(ScoresFilterBase)
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
#if HKU_SUPPORT_SERIALIZATION
|
|
89
|
+
#define SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION \
|
|
90
|
+
private: \
|
|
91
|
+
friend class boost::serialization::access; \
|
|
92
|
+
template <class Archive> \
|
|
93
|
+
void serialize(Archive& ar, const unsigned int version) { \
|
|
94
|
+
ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(ScoresFilterBase); \
|
|
95
|
+
}
|
|
96
|
+
#else
|
|
97
|
+
#define SCORESFILTER_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
98
|
+
#endif
|
|
99
|
+
|
|
100
|
+
typedef std::shared_ptr<ScoresFilterBase> ScoresFilterPtr;
|
|
101
|
+
typedef std::shared_ptr<ScoresFilterBase> SCFilterPtr;
|
|
102
|
+
|
|
103
|
+
#define SCORESFILTER_IMP(classname) \
|
|
104
|
+
public: \
|
|
105
|
+
virtual ScoresFilterPtr _clone() override { \
|
|
106
|
+
return std::make_shared<classname>(); \
|
|
107
|
+
} \
|
|
108
|
+
virtual ScoreRecordList _filter(const ScoreRecordList& scores, const Datetime& date, \
|
|
109
|
+
const KQuery& query) override;
|
|
110
|
+
|
|
111
|
+
HKU_API std::ostream& operator<<(std::ostream&, const ScoresFilterBase&);
|
|
112
|
+
HKU_API std::ostream& operator<<(std::ostream&, const ScoresFilterPtr&);
|
|
113
|
+
|
|
114
|
+
HKU_API ScoresFilterPtr operator|(const ScoresFilterPtr& a, const ScoresFilterPtr& b);
|
|
115
|
+
|
|
116
|
+
} // namespace hku
|
|
117
|
+
|
|
118
|
+
#if FMT_VERSION >= 90000
|
|
119
|
+
template <>
|
|
120
|
+
struct fmt::formatter<hku::ScoresFilterBase> : ostream_formatter {};
|
|
121
|
+
|
|
122
|
+
template <>
|
|
123
|
+
struct fmt::formatter<hku::ScoresFilterPtr> : ostream_formatter {};
|
|
124
|
+
#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
|
|
@@ -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 NormQuantileUniform : public NormalizeBase {
|
|
18
|
+
NORMALIZE_IMP(NormQuantileUniform)
|
|
19
|
+
NORMALIZE_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
20
|
+
|
|
21
|
+
public:
|
|
22
|
+
NormQuantileUniform();
|
|
23
|
+
NormQuantileUniform(double quantile_min, double quantile_max);
|
|
24
|
+
virtual ~NormQuantileUniform() override;
|
|
25
|
+
virtual void _checkParam(const string& name) const override;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
} // namespace hku
|
|
@@ -0,0 +1,25 @@
|
|
|
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 NormZScore : public NormalizeBase {
|
|
15
|
+
NORMALIZE_IMP(NormZScore)
|
|
16
|
+
NORMALIZE_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
NormZScore();
|
|
20
|
+
NormZScore(bool outExtreme, double nsigma, bool recursive);
|
|
21
|
+
virtual ~NormZScore() override;
|
|
22
|
+
virtual void _checkParam(const string& name) const override;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
} // namespace hku
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-10-15
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/DataType.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
PriceList quantile_trunc(const PriceList &src, double quantile_min, double quantile_max);
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -88,7 +88,7 @@ public:
|
|
|
88
88
|
|
|
89
89
|
/** 克隆操作 */
|
|
90
90
|
typedef shared_ptr<Portfolio> PortfolioPtr;
|
|
91
|
-
PortfolioPtr clone()
|
|
91
|
+
PortfolioPtr clone();
|
|
92
92
|
|
|
93
93
|
/** 运行前准备 */
|
|
94
94
|
void readyForRun();
|
|
@@ -99,12 +99,23 @@ public:
|
|
|
99
99
|
virtual string str() const;
|
|
100
100
|
|
|
101
101
|
virtual void _reset() {}
|
|
102
|
-
virtual PortfolioPtr _clone()
|
|
102
|
+
virtual PortfolioPtr _clone() {
|
|
103
103
|
return std::make_shared<Portfolio>();
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
virtual void _readyForRun() {}
|
|
107
107
|
virtual void _runMoment(const Datetime& date, const Datetime& nextCycle, bool adjust) {}
|
|
108
|
+
virtual void _runMomentOnOpen(const Datetime& date, const Datetime& nextCycle, bool adjust) {}
|
|
109
|
+
virtual void _runMomentOnClose(const Datetime& date, const Datetime& nextCycle, bool adjust) {}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 回测完成后,返回最后一天交易记录,以及需要延迟的买入和卖出延迟请求
|
|
113
|
+
*/
|
|
114
|
+
virtual json lastSuggestion() const;
|
|
115
|
+
|
|
116
|
+
virtual bool isPythonObject() const {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
108
119
|
|
|
109
120
|
private:
|
|
110
121
|
void initParam();
|
|
@@ -115,10 +126,6 @@ private:
|
|
|
115
126
|
const string& mode);
|
|
116
127
|
|
|
117
128
|
protected:
|
|
118
|
-
virtual bool isPythonObject() const {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
129
|
// 跟踪打印当前TM持仓情况
|
|
123
130
|
void traceMomentTMAfterRunAtOpen(const Datetime& date);
|
|
124
131
|
void traceMomentTMAfterRunAtClose(const Datetime& date);
|
|
@@ -170,13 +177,13 @@ private:
|
|
|
170
177
|
#endif /* HKU_SUPPORT_SERIALIZATION */
|
|
171
178
|
};
|
|
172
179
|
|
|
173
|
-
#define PORTFOLIO_IMP(classname)
|
|
174
|
-
public:
|
|
175
|
-
virtual PortfolioPtr _clone()
|
|
176
|
-
return std::make_shared<classname>();
|
|
177
|
-
}
|
|
178
|
-
virtual void _reset() override;
|
|
179
|
-
virtual void _readyForRun() override;
|
|
180
|
+
#define PORTFOLIO_IMP(classname) \
|
|
181
|
+
public: \
|
|
182
|
+
virtual PortfolioPtr _clone() override { \
|
|
183
|
+
return std::make_shared<classname>(); \
|
|
184
|
+
} \
|
|
185
|
+
virtual void _reset() override; \
|
|
186
|
+
virtual void _readyForRun() override; \
|
|
180
187
|
virtual void _runMoment(const Datetime& date, const Datetime& nextCycle, bool adjust) override;
|
|
181
188
|
|
|
182
189
|
/**
|
|
@@ -28,6 +28,13 @@ public:
|
|
|
28
28
|
SimplePortfolio(const TradeManagerPtr& tm, const SelectorPtr& se, const AFPtr& af);
|
|
29
29
|
virtual ~SimplePortfolio();
|
|
30
30
|
|
|
31
|
+
virtual void _runMomentOnOpen(const Datetime& date, const Datetime& nextCycle,
|
|
32
|
+
bool adjust) override;
|
|
33
|
+
virtual void _runMomentOnClose(const Datetime& date, const Datetime& nextCycle,
|
|
34
|
+
bool adjust) override;
|
|
35
|
+
|
|
36
|
+
virtual json lastSuggestion() const override;
|
|
37
|
+
|
|
31
38
|
private:
|
|
32
39
|
SystemList m_dlist_sys_list; // 因证券退市,无法执行卖出的系统(资产全部损失)
|
|
33
40
|
SystemWeightList m_delay_adjust_sys_list; // 延迟调仓卖出的系统列表
|
|
@@ -25,6 +25,13 @@ public:
|
|
|
25
25
|
WithoutAFPortfolio(const TradeManagerPtr& tm, const SelectorPtr& se);
|
|
26
26
|
virtual ~WithoutAFPortfolio();
|
|
27
27
|
|
|
28
|
+
virtual void _runMomentOnOpen(const Datetime& date, const Datetime& nextCycle,
|
|
29
|
+
bool adjust) override;
|
|
30
|
+
virtual void _runMomentOnClose(const Datetime& date, const Datetime& nextCycle,
|
|
31
|
+
bool adjust) override;
|
|
32
|
+
|
|
33
|
+
virtual json lastSuggestion() const override;
|
|
34
|
+
|
|
28
35
|
private:
|
|
29
36
|
void initParam();
|
|
30
37
|
void _runMomentWithoutAFNotForceSell(const Datetime& date, const Datetime& nextCycle,
|
|
@@ -62,8 +62,8 @@ public:
|
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* 买入时计算目标价格
|
|
65
|
-
* @param datetime
|
|
66
|
-
* @param price
|
|
65
|
+
* @param datetime 当前时间
|
|
66
|
+
* @param price 当前价格
|
|
67
67
|
* @return 返回Null<price_t>时,表示未限定目标; 返回0,意味着需要卖出
|
|
68
68
|
*/
|
|
69
69
|
virtual price_t getGoal(const Datetime& datetime, price_t price) = 0;
|
|
@@ -80,9 +80,8 @@ public:
|
|
|
80
80
|
virtual ProfitGoalPtr _clone() = 0;
|
|
81
81
|
|
|
82
82
|
/** 子类计算接口,由setTO调用 */
|
|
83
|
-
virtual void _calculate()
|
|
83
|
+
virtual void _calculate() {}
|
|
84
84
|
|
|
85
|
-
protected:
|
|
86
85
|
virtual bool isPythonObject() const {
|
|
87
86
|
return false;
|
|
88
87
|
}
|
|
@@ -143,13 +142,12 @@ private: \
|
|
|
143
142
|
#define PROFIT_GOAL_NO_PRIVATE_MEMBER_SERIALIZATION
|
|
144
143
|
#endif
|
|
145
144
|
|
|
146
|
-
#define PROFITGOAL_IMP(classname)
|
|
147
|
-
public:
|
|
148
|
-
virtual ProfitGoalPtr _clone() override {
|
|
149
|
-
return std::make_shared<classname>();
|
|
150
|
-
}
|
|
151
|
-
virtual price_t getGoal(const Datetime&, price_t) override;
|
|
152
|
-
virtual void _calculate() override;
|
|
145
|
+
#define PROFITGOAL_IMP(classname) \
|
|
146
|
+
public: \
|
|
147
|
+
virtual ProfitGoalPtr _clone() override { \
|
|
148
|
+
return std::make_shared<classname>(); \
|
|
149
|
+
} \
|
|
150
|
+
virtual price_t getGoal(const Datetime&, price_t) override;
|
|
153
151
|
|
|
154
152
|
/**
|
|
155
153
|
* 客户程序都应使用该指针类型
|