Skip to content

Commit

Permalink
SYS_WalkForward 默认寻优 SE 调整为按账户年化收益率排序寻优
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Nov 2, 2024
1 parent bba3f70 commit 3078c13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
8 changes: 1 addition & 7 deletions hikyuu_cpp/hikyuu/trade_sys/system/crt/SYS_WalkForward.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,10 @@

namespace hku {

// SystemPtr HKU_API SYS_WalkForward(const SystemList& candidate_sys_list,
// const TradeManagerPtr& tm = TradeManagerPtr(),
// size_t train_len = 100, size_t test_len = 20,
// const string& key = "帐户平均年收益率%",
// const TradeManagerPtr& train_tm = TradeManagerPtr());

SystemPtr HKU_API SYS_WalkForward(const SystemList& candidate_sys_list,
const TradeManagerPtr& tm = TradeManagerPtr(),
size_t train_len = 100, size_t test_len = 20,
const SelectorPtr& se = SE_MaxFundsOptimal(),
const SelectorPtr& se = SE_PerformanceOptimal(),
const TradeManagerPtr& train_tm = TradeManagerPtr());

} // namespace hku
9 changes: 4 additions & 5 deletions hikyuu_pywrap/trade_sys/_System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ void export_System(py::module& m) {
DEF_PICKLE(TradeRequest);

//--------------------------------------------------------------------------------------
py::class_<System, SystemPtr>(
m, "System",
R"(系统基类。需要扩展或实现更复杂的系统交易行为,可从此类继承。
py::class_<System, SystemPtr>(m, "System",
R"(系统基类。需要扩展或实现更复杂的系统交易行为,可从此类继承。
系统是指针对单个交易对象的完整策略,包括环境判断、系统有效条件、资金管理、止损、止盈、盈利目标、移滑价差的完整策略,用于模拟回测。
Expand Down Expand Up @@ -275,7 +274,7 @@ void export_System(py::module& m) {
SystemList sys_list = python_list_to_vector<SystemPtr>(candidate_sys_list);
SelectorPtr c_se = se;
if (!c_se) {
c_se = SE_MaxFundsOptimal();
c_se = SE_PerformanceOptimal();
}
return SYS_WalkForward(sys_list, tm, train_len, test_len, c_se, train_tm);
},
Expand All @@ -290,6 +289,6 @@ void export_System(py::module& m) {
:param TradeManager tm: 交易账户
:param int train_len: 滚动评估系统绩效时使用的数据长度
:param int test_len: 使用在 train_len 中选出的最优系统执行的数据长度
:param SelectorBase se: 寻优选择器
:param SelectorBase se: 寻优选择器,默认为按“帐户平均年收益率%”最大选择
:param TradeManager train_tm: 滚动评估时使用的交易账户, 为None时, 使用 tm 的拷贝进行评估)");
}

0 comments on commit 3078c13

Please sign in to comment.