补充测试

This commit is contained in:
fasiondog 2024-06-09 17:39:43 +08:00
parent 917171c3a0
commit 74acf9bc8c

View File

@ -31,7 +31,7 @@ TEST_CASE("test_SE_MultiFactor") {
StockManager& sm = StockManager::instance();
StockList stks{sm["sh600004"], sm["sh600005"], sm["sz000001"], sm["sz000002"]};
Stock ref_stk = sm["sh000001"];
KQuery query = KQuery(-100);
KQuery query = KQueryByDate(Datetime(20110712), Datetime(20111206));
IndicatorList src_inds{MA(CLOSE()), EMA(CLOSE())};
auto sys = SYS_Simple(crtTM(), MM_Nothing());
@ -52,6 +52,20 @@ TEST_CASE("test_SE_MultiFactor") {
ret->addStockList(stks, sys);
auto proto_list = ret->getProtoSystemList();
ret->calculate(proto_list, query);
auto sw_list = ret->getSelected(Datetime(20110712));
CHECK_EQ(sw_list.size(), 4);
/** @arg topn = 2 */
ret = SE_MultiFactor(src_inds, 2, 5, 120, ref_stk);
ret->addStockList(stks, sys);
proto_list = ret->getProtoSystemList();
ret->calculate(proto_list, query);
sw_list = ret->getSelected(Datetime(20110712));
CHECK_EQ(sw_list.size(), 2);
// for (const auto& sw : sw_list) {
// HKU_INFO("{} {}", sw.sys->name(), sw.weight);
// }
}
//-----------------------------------------------------------------------------