2021-02-11 00:47:22 +08:00
|
|
|
/*
|
|
|
|
* Copyright(C) 2021 hikyuu.org
|
|
|
|
*
|
|
|
|
* Create on: 2021-02-10
|
|
|
|
* Author: fasiondog
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "StrategyContext.h"
|
|
|
|
|
|
|
|
namespace hku {
|
|
|
|
|
|
|
|
void StrategyContext::setStockCodeList(const vector<string>& stockList) {
|
|
|
|
m_stockCodeList.resize(stockList.size());
|
|
|
|
std::copy(stockList.begin(), stockList.end(), m_stockCodeList.begin());
|
|
|
|
}
|
|
|
|
|
2021-02-19 01:12:50 +08:00
|
|
|
void StrategyContext::setKTypeList(const vector<KQuery::KType>& ktypeList) {
|
|
|
|
m_ktypeList.resize(ktypeList.size());
|
|
|
|
std::transform(ktypeList.begin(), ktypeList.end(), m_ktypeList.begin(),
|
|
|
|
[](KQuery::KType ktype) {
|
|
|
|
to_upper(ktype);
|
|
|
|
return ktype;
|
|
|
|
});
|
2024-05-07 01:49:38 +08:00
|
|
|
|
|
|
|
// 对 ktype 按时间长度进行升序排序
|
|
|
|
std::sort(m_ktypeList.begin(), m_ktypeList.end(),
|
|
|
|
[](const KQuery::KType& a, const KQuery::KType& b) {
|
|
|
|
return KQuery::getKTypeInMin(a) < KQuery::getKTypeInMin(b);
|
|
|
|
});
|
2021-02-19 01:12:50 +08:00
|
|
|
}
|
|
|
|
|
2021-02-17 16:08:24 +08:00
|
|
|
bool StrategyContext::isAll() const {
|
|
|
|
return std::find_if(m_stockCodeList.begin(), m_stockCodeList.end(), [](string val) {
|
|
|
|
to_upper(val);
|
|
|
|
return val == "ALL";
|
|
|
|
}) != m_stockCodeList.end();
|
|
|
|
}
|
|
|
|
|
2021-02-11 00:47:22 +08:00
|
|
|
} // namespace hku
|