mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-11-29 18:39:10 +08:00
清理 cppcheck 风格告警
This commit is contained in:
parent
56d22accf4
commit
6c529ee2e7
@ -32,9 +32,10 @@
|
||||
<suppression>ConfigurationNotChecked</suppression>
|
||||
<suppression>toomanyconfigs</suppression>
|
||||
<suppression>unknownMacro</suppression>
|
||||
<suppression>useStlAlgorithm</suppression>
|
||||
<suppression>shadowFunction</suppression>
|
||||
<suppression>missingIncludeSystem</suppression>
|
||||
<suppression>missingInclude</suppression>
|
||||
<suppression>cstyleCast</suppression>
|
||||
<suppression>shadowFunction</suppression>
|
||||
<suppression>useStlAlgorithm</suppression>
|
||||
</suppressions>
|
||||
</project>
|
||||
|
@ -34,6 +34,9 @@ public:
|
||||
static StockManager& instance();
|
||||
virtual ~StockManager();
|
||||
|
||||
StockManager(const StockManager&) = delete;
|
||||
StockManager& operator=(const StockManager&) = delete;
|
||||
|
||||
/**
|
||||
* 初始化函数,必须在程序入口调用
|
||||
* @param baseInfoParam 基础信息驱动参数
|
||||
|
@ -47,7 +47,7 @@ struct TdxMinData {
|
||||
float close;
|
||||
float amount;
|
||||
uint32_t vol;
|
||||
uint32_t other;
|
||||
uint32_t other; // cppcheck-suppress unusedStructMember
|
||||
|
||||
Datetime getDatetime() {
|
||||
int tmp_date = date >> 11;
|
||||
|
@ -50,6 +50,7 @@ std::string getVersionWithGit() {
|
||||
return HKU_VERSION_GIT;
|
||||
}
|
||||
|
||||
// cppcheck-suppress constParameterReference
|
||||
static bool readUUID(boost::uuids::uuid& out) {
|
||||
std::string filename = fmt::format("{}/.hikyuu/uid", getUserDir());
|
||||
FILE* fp = fopen(filename.c_str(), "rb");
|
||||
|
@ -389,7 +389,7 @@ IndicatorImpPtr IndicatorImp::getResult(size_t result_num) {
|
||||
size_t total = size();
|
||||
imp->_readyBuffer(total, 1);
|
||||
imp->setDiscard(discard());
|
||||
auto *src = this->data(result_num);
|
||||
auto const *src = this->data(result_num);
|
||||
auto *dst = imp->data(0);
|
||||
for (size_t i = discard(); i < total; ++i) {
|
||||
// imp->_set(get(i, result_num), i);
|
||||
@ -400,18 +400,18 @@ IndicatorImpPtr IndicatorImp::getResult(size_t result_num) {
|
||||
|
||||
price_t IndicatorImp::get(size_t pos, size_t num) const {
|
||||
#if CHECK_ACCESS_BOUND
|
||||
HKU_CHECK_THROW((num < MAX_RESULT_NUM && m_pBuffer[num] && pos < m_pBuffer[num]->size()),
|
||||
std::out_of_range, "Try to access value ({}) out of bounds [0..{})! {}", pos,
|
||||
m_pBuffer[num]->size(), name());
|
||||
HKU_CHECK_THROW(
|
||||
(num <= MAX_RESULT_NUM && m_pBuffer[num] && pos < m_pBuffer[num]->size()), std::out_of_range,
|
||||
"Try to access value out of bounds! num: {}, pos: {}, name: {}", num, pos, name());
|
||||
#endif
|
||||
return (*m_pBuffer[num])[pos];
|
||||
}
|
||||
|
||||
void IndicatorImp::_set(price_t val, size_t pos, size_t num) {
|
||||
#if CHECK_ACCESS_BOUND
|
||||
HKU_CHECK_THROW((num < MAX_RESULT_NUM && m_pBuffer[num] && pos < m_pBuffer[num]->size()),
|
||||
std::out_of_range, "Try to access value out of bounds! (pos={}) {}", pos,
|
||||
name());
|
||||
HKU_CHECK_THROW(
|
||||
(num <= MAX_RESULT_NUM && m_pBuffer[num] && pos < m_pBuffer[num]->size()), std::out_of_range,
|
||||
"Try to access value out of bounds! num: {}, pos: {}, name: {}", num, pos, name());
|
||||
#endif
|
||||
(*m_pBuffer[num])[pos] = val;
|
||||
}
|
||||
@ -834,7 +834,7 @@ void IndicatorImp::execute_weave() {
|
||||
size_t diff = maxp->size() - minp->size();
|
||||
_readyBuffer(total, result_number);
|
||||
setDiscard(discard);
|
||||
value_type *src = nullptr;
|
||||
value_type const *src = nullptr;
|
||||
value_type *dst = nullptr;
|
||||
if (m_left->size() >= m_right->size()) {
|
||||
size_t num = m_left->getResultNumber();
|
||||
@ -899,8 +899,8 @@ void IndicatorImp::execute_add() {
|
||||
_readyBuffer(total, result_number);
|
||||
setDiscard(discard);
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
auto *data1 = maxp->data(r);
|
||||
auto *data2 = minp->data(r);
|
||||
auto const *data1 = maxp->data(r);
|
||||
auto const *data2 = minp->data(r);
|
||||
auto *result = this->data(r);
|
||||
for (size_t i = discard; i < total; ++i) {
|
||||
// _set(maxp->get(i, r) + minp->get(i - diff, r), i, r);
|
||||
@ -913,7 +913,7 @@ void IndicatorImp::execute_sub() {
|
||||
m_right->calculate();
|
||||
m_left->calculate();
|
||||
|
||||
IndicatorImp *maxp, *minp;
|
||||
const IndicatorImp *maxp, *minp;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
maxp = m_left.get();
|
||||
minp = m_right.get();
|
||||
@ -979,8 +979,8 @@ void IndicatorImp::execute_mul() {
|
||||
_readyBuffer(total, result_number);
|
||||
setDiscard(discard);
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
auto *data1 = maxp->data(r);
|
||||
auto *data2 = minp->data(r);
|
||||
auto const *data1 = maxp->data(r);
|
||||
auto const *data2 = minp->data(r);
|
||||
auto *result = this->data(r);
|
||||
for (size_t i = discard; i < total; ++i) {
|
||||
// _set(maxp->get(i, r) * minp->get(i - diff, r), i, r);
|
||||
@ -993,7 +993,7 @@ void IndicatorImp::execute_div() {
|
||||
m_right->calculate();
|
||||
m_left->calculate();
|
||||
|
||||
IndicatorImp *maxp, *minp;
|
||||
const IndicatorImp *maxp, *minp;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
maxp = m_left.get();
|
||||
minp = m_right.get();
|
||||
@ -1076,8 +1076,8 @@ void IndicatorImp::execute_mod() {
|
||||
_readyBuffer(total, result_number);
|
||||
setDiscard(discard);
|
||||
value_type *dst = nullptr;
|
||||
value_type *left = nullptr;
|
||||
value_type *right = nullptr;
|
||||
value_type const *left = nullptr;
|
||||
value_type const *right = nullptr;
|
||||
value_type null_value = Null<value_type>();
|
||||
if (m_left->size() > m_right->size()) {
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
@ -1143,8 +1143,8 @@ void IndicatorImp::execute_eq() {
|
||||
setDiscard(discard);
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
auto *dst = this->data(r);
|
||||
auto *maxdata = maxp->data(r);
|
||||
auto *mindata = minp->data(r);
|
||||
auto const *maxdata = maxp->data(r);
|
||||
auto const *mindata = minp->data(r);
|
||||
for (size_t i = discard; i < total; ++i) {
|
||||
if (std::abs(maxdata[i] - mindata[i - diff]) < IND_EQ_THRESHOLD) {
|
||||
dst[i] = 1.0;
|
||||
@ -1185,8 +1185,8 @@ void IndicatorImp::execute_ne() {
|
||||
setDiscard(discard);
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
auto *dst = this->data(r);
|
||||
auto *maxdata = maxp->data(r);
|
||||
auto *mindata = minp->data(r);
|
||||
auto const *maxdata = maxp->data(r);
|
||||
auto const *mindata = minp->data(r);
|
||||
for (size_t i = discard; i < total; ++i) {
|
||||
if (std::abs(maxdata[i] - mindata[i - diff]) < IND_EQ_THRESHOLD) {
|
||||
dst[i] = 0.0;
|
||||
@ -1206,7 +1206,7 @@ void IndicatorImp::execute_gt() {
|
||||
m_right->calculate();
|
||||
m_left->calculate();
|
||||
|
||||
IndicatorImp *maxp, *minp;
|
||||
const IndicatorImp *maxp, *minp;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
maxp = m_left.get();
|
||||
minp = m_right.get();
|
||||
@ -1226,8 +1226,8 @@ void IndicatorImp::execute_gt() {
|
||||
_readyBuffer(total, result_number);
|
||||
setDiscard(discard);
|
||||
value_type *dst = nullptr;
|
||||
value_type *left = nullptr;
|
||||
value_type *right = nullptr;
|
||||
value_type const *left = nullptr;
|
||||
value_type const *right = nullptr;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
dst = this->data(r);
|
||||
@ -1271,7 +1271,7 @@ void IndicatorImp::execute_lt() {
|
||||
m_right->calculate();
|
||||
m_left->calculate();
|
||||
|
||||
IndicatorImp *maxp, *minp;
|
||||
const IndicatorImp *maxp, *minp;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
maxp = m_left.get();
|
||||
minp = m_right.get();
|
||||
@ -1291,8 +1291,8 @@ void IndicatorImp::execute_lt() {
|
||||
_readyBuffer(total, result_number);
|
||||
setDiscard(discard);
|
||||
value_type *dst = nullptr;
|
||||
value_type *left = nullptr;
|
||||
value_type *right = nullptr;
|
||||
value_type const *left = nullptr;
|
||||
value_type const *right = nullptr;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
dst = this->data(r);
|
||||
@ -1336,7 +1336,7 @@ void IndicatorImp::execute_ge() {
|
||||
m_right->calculate();
|
||||
m_left->calculate();
|
||||
|
||||
IndicatorImp *maxp, *minp;
|
||||
const IndicatorImp *maxp, *minp;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
maxp = m_left.get();
|
||||
minp = m_right.get();
|
||||
@ -1356,8 +1356,8 @@ void IndicatorImp::execute_ge() {
|
||||
_readyBuffer(total, result_number);
|
||||
setDiscard(discard);
|
||||
value_type *dst = nullptr;
|
||||
value_type *left = nullptr;
|
||||
value_type *right = nullptr;
|
||||
value_type const *left = nullptr;
|
||||
value_type const *right = nullptr;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
dst = this->data(r);
|
||||
@ -1401,7 +1401,7 @@ void IndicatorImp::execute_le() {
|
||||
m_right->calculate();
|
||||
m_left->calculate();
|
||||
|
||||
IndicatorImp *maxp, *minp;
|
||||
const IndicatorImp *maxp, *minp;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
maxp = m_left.get();
|
||||
minp = m_right.get();
|
||||
@ -1421,8 +1421,8 @@ void IndicatorImp::execute_le() {
|
||||
_readyBuffer(total, result_number);
|
||||
setDiscard(discard);
|
||||
value_type *dst = nullptr;
|
||||
value_type *left = nullptr;
|
||||
value_type *right = nullptr;
|
||||
value_type const *left = nullptr;
|
||||
value_type const *right = nullptr;
|
||||
if (m_left->size() > m_right->size()) {
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
dst = this->data(r);
|
||||
@ -1466,7 +1466,7 @@ void IndicatorImp::execute_and() {
|
||||
m_right->calculate();
|
||||
m_left->calculate();
|
||||
|
||||
IndicatorImp *maxp, *minp;
|
||||
const IndicatorImp *maxp, *minp;
|
||||
if (m_right->size() > m_left->size()) {
|
||||
maxp = m_right.get();
|
||||
minp = m_left.get();
|
||||
@ -1487,8 +1487,8 @@ void IndicatorImp::execute_and() {
|
||||
setDiscard(discard);
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
auto *dst = this->data(r);
|
||||
auto *maxdata = maxp->data(r);
|
||||
auto *mindata = minp->data(r);
|
||||
auto const *maxdata = maxp->data(r);
|
||||
auto const *mindata = minp->data(r);
|
||||
for (size_t i = discard; i < total; ++i) {
|
||||
if (maxdata[i] >= IND_EQ_THRESHOLD && mindata[i - diff] >= IND_EQ_THRESHOLD) {
|
||||
dst[i] = 1.0;
|
||||
@ -1530,8 +1530,8 @@ void IndicatorImp::execute_or() {
|
||||
setDiscard(discard);
|
||||
for (size_t r = 0; r < result_number; ++r) {
|
||||
auto *dst = this->data(r);
|
||||
auto *maxdata = maxp->data(r);
|
||||
auto *mindata = minp->data(r);
|
||||
auto const *maxdata = maxp->data(r);
|
||||
auto const *mindata = minp->data(r);
|
||||
for (size_t i = discard; i < total; ++i) {
|
||||
if (maxdata[i] >= IND_EQ_THRESHOLD || mindata[i - diff] >= IND_EQ_THRESHOLD) {
|
||||
dst[i] = 1.0;
|
||||
@ -1642,8 +1642,8 @@ void IndicatorImp::execute_corr() {
|
||||
|
||||
auto *dst0 = this->data(0);
|
||||
auto *dst1 = this->data(1);
|
||||
auto *maxdata = maxp->data(0);
|
||||
auto *mindata = minp->data(0);
|
||||
auto const *maxdata = maxp->data(0);
|
||||
auto const *mindata = minp->data(0);
|
||||
for (size_t i = startPos + 1; i < first_end; i++) {
|
||||
ix = maxdata[i] - kx;
|
||||
iy = mindata[i] - ky;
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
public:
|
||||
/** 默认构造函数 */
|
||||
IndicatorImp();
|
||||
IndicatorImp(const string& name);
|
||||
explicit IndicatorImp(const string& name);
|
||||
IndicatorImp(const string& name, size_t result_num);
|
||||
|
||||
virtual ~IndicatorImp();
|
||||
|
@ -22,7 +22,7 @@ class IAd : public IndicatorImp {
|
||||
|
||||
public:
|
||||
IAd();
|
||||
IAd(const KData&);
|
||||
explicit IAd(const KData&);
|
||||
virtual ~IAd();
|
||||
};
|
||||
|
||||
|
@ -48,10 +48,8 @@ void IBackset::_calculate(const Indicator& ind) {
|
||||
size_t j = i;
|
||||
size_t end_j = i - n + 1;
|
||||
while (j-- > end_j) {
|
||||
if (dst[j] != 1.0) {
|
||||
dst[j] = 1.0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (dst[i] != 1.0) {
|
||||
dst[i] = 0.0;
|
||||
|
@ -34,7 +34,6 @@ void IEvery::_calculate(const Indicator& ind) {
|
||||
|
||||
int n = getParam<int>("n");
|
||||
if (0 == n) {
|
||||
n = total;
|
||||
m_discard = ind.discard();
|
||||
for (size_t i = m_discard; i < total; i++) {
|
||||
price_t every = 1.0;
|
||||
|
@ -34,7 +34,6 @@ void IExist::_calculate(const Indicator& ind) {
|
||||
|
||||
int n = getParam<int>("n");
|
||||
if (n == 0) {
|
||||
n = total;
|
||||
m_discard = ind.discard();
|
||||
for (size_t i = m_discard; i < total; i++) {
|
||||
price_t exist = 0.0;
|
||||
|
@ -20,7 +20,7 @@ class ILiuTongPan : public IndicatorImp {
|
||||
|
||||
public:
|
||||
ILiuTongPan();
|
||||
ILiuTongPan(const KData&);
|
||||
explicit ILiuTongPan(const KData&);
|
||||
virtual ~ILiuTongPan();
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,7 @@ class ITimeLine : public IndicatorImp {
|
||||
|
||||
public:
|
||||
ITimeLine();
|
||||
ITimeLine(const KData&);
|
||||
explicit ITimeLine(const KData&);
|
||||
virtual ~ITimeLine();
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,7 @@ class IVigor : public IndicatorImp {
|
||||
|
||||
public:
|
||||
IVigor();
|
||||
IVigor(int n);
|
||||
explicit IVigor(int n);
|
||||
virtual ~IVigor();
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@ class HKU_API StrategyBase {
|
||||
|
||||
public:
|
||||
StrategyBase();
|
||||
StrategyBase(const string& name);
|
||||
explicit StrategyBase(const string& name);
|
||||
StrategyBase(const string& name, const string& config_file);
|
||||
|
||||
virtual ~StrategyBase();
|
||||
|
@ -42,8 +42,9 @@ class HKU_API TradeManager : public TradeManagerBase {
|
||||
// PARAMETER_SUPPORT
|
||||
|
||||
public:
|
||||
TradeManager(const Datetime& datetime = Datetime(199001010000LL), price_t initcash = 100000.0,
|
||||
const TradeCostPtr& costfunc = TC_Zero(), const string& name = "SYS");
|
||||
explicit TradeManager(const Datetime& datetime = Datetime(199001010000LL),
|
||||
price_t initcash = 100000.0, const TradeCostPtr& costfunc = TC_Zero(),
|
||||
const string& name = "SYS");
|
||||
virtual ~TradeManager();
|
||||
|
||||
/** 复位,清空交易、持仓记录 */
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
|
||||
price_t at(size_t pos) const;
|
||||
|
||||
price_t* data();
|
||||
price_t const* data() const;
|
||||
|
||||
/** 复位操作 */
|
||||
void reset();
|
||||
@ -223,7 +223,7 @@ inline size_t ConditionBase::size() const {
|
||||
return m_values.size();
|
||||
}
|
||||
|
||||
inline price_t* ConditionBase::data() {
|
||||
inline price_t const* ConditionBase::data() const {
|
||||
return m_values.data();
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ void AddCondition::_calculate() {
|
||||
}
|
||||
|
||||
if (m_cond1 && !m_cond2) {
|
||||
price_t* data = m_cond1->data();
|
||||
price_t const* data = m_cond1->data();
|
||||
for (size_t i = 0, total = m_cond1->size(); i < total; i++) {
|
||||
m_values[i] = data[i];
|
||||
}
|
||||
@ -40,7 +40,7 @@ void AddCondition::_calculate() {
|
||||
}
|
||||
|
||||
if (!m_cond1 && m_cond2) {
|
||||
price_t* data = m_cond2->data();
|
||||
auto const* data = m_cond2->data();
|
||||
for (size_t i = 0, total = m_cond2->size(); i < total; i++) {
|
||||
m_values[i] = data[i];
|
||||
}
|
||||
@ -50,8 +50,8 @@ void AddCondition::_calculate() {
|
||||
size_t total = m_kdata.size();
|
||||
HKU_ASSERT(m_cond1->size() == total && m_cond2->size() == total);
|
||||
|
||||
price_t* data1 = m_cond1->data();
|
||||
price_t* data2 = m_cond2->data();
|
||||
auto const* data1 = m_cond1->data();
|
||||
auto const* data2 = m_cond2->data();
|
||||
for (size_t i = 0; i < total; i++) {
|
||||
m_values[i] = data1[i] + data2[i];
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ void AndCondition::_calculate() {
|
||||
size_t total = m_kdata.size();
|
||||
HKU_ASSERT(m_cond1->size() == total && m_cond2->size() == total);
|
||||
|
||||
price_t* data1 = m_cond1->data();
|
||||
price_t* data2 = m_cond2->data();
|
||||
auto const* data1 = m_cond1->data();
|
||||
auto const* data2 = m_cond2->data();
|
||||
for (size_t i = 0; i < total; i++) {
|
||||
m_values[i] = (data1[i] > 0.0 && data2[i] > 0.0) ? 1.0 : 0.0;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace hku {
|
||||
class BoolCondition : public ConditionBase {
|
||||
public:
|
||||
BoolCondition();
|
||||
BoolCondition(const Indicator&);
|
||||
explicit BoolCondition(const Indicator&);
|
||||
virtual ~BoolCondition();
|
||||
|
||||
virtual void _calculate() override;
|
||||
|
@ -38,8 +38,8 @@ void DivCondition::_calculate() {
|
||||
size_t total = m_kdata.size();
|
||||
HKU_ASSERT(m_cond1->size() == total && m_cond2->size() == total);
|
||||
|
||||
price_t* data1 = m_cond1->data();
|
||||
price_t* data2 = m_cond2->data();
|
||||
auto const* data1 = m_cond1->data();
|
||||
auto const* data2 = m_cond2->data();
|
||||
for (size_t i = 0; i < total; i++) {
|
||||
m_values[i] = data2[i] == 0.0 || std::isnan(data2[i]) ? null_price : data1[i] / data2[i];
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ void MultiCondition::_calculate() {
|
||||
size_t total = m_kdata.size();
|
||||
HKU_ASSERT(m_cond1->size() == total && m_cond2->size() == total);
|
||||
|
||||
price_t* data1 = m_cond1->data();
|
||||
price_t* data2 = m_cond2->data();
|
||||
auto const* data1 = m_cond1->data();
|
||||
auto const* data2 = m_cond2->data();
|
||||
for (size_t i = 0; i < total; i++) {
|
||||
m_values[i] = data1[i] * data2[i];
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace hku {
|
||||
class OPLineCondition : public ConditionBase {
|
||||
public:
|
||||
OPLineCondition();
|
||||
OPLineCondition(const Indicator&);
|
||||
explicit OPLineCondition(const Indicator&);
|
||||
virtual ~OPLineCondition();
|
||||
|
||||
virtual void _calculate() override;
|
||||
|
@ -32,7 +32,7 @@ void OrCondition::_calculate() {
|
||||
}
|
||||
|
||||
if (m_cond1 && !m_cond2) {
|
||||
price_t* data = m_cond1->data();
|
||||
auto const* data = m_cond1->data();
|
||||
for (size_t i = 0, total = m_cond1->size(); i < total; i++) {
|
||||
if (data[i] > 0.0) {
|
||||
m_values[i] = 1.0;
|
||||
@ -42,7 +42,7 @@ void OrCondition::_calculate() {
|
||||
}
|
||||
|
||||
if (!m_cond1 && m_cond2) {
|
||||
price_t* data = m_cond2->data();
|
||||
auto const* data = m_cond2->data();
|
||||
for (size_t i = 0, total = m_cond2->size(); i < total; i++) {
|
||||
if (data[i] > 0.0) {
|
||||
m_values[i] = 1.0;
|
||||
@ -54,8 +54,8 @@ void OrCondition::_calculate() {
|
||||
size_t total = m_kdata.size();
|
||||
HKU_ASSERT(m_cond1->size() == total && m_cond2->size() == total);
|
||||
|
||||
price_t* data1 = m_cond1->data();
|
||||
price_t* data2 = m_cond2->data();
|
||||
auto const* data1 = m_cond1->data();
|
||||
auto const* data2 = m_cond2->data();
|
||||
for (size_t i = 0; i < total; i++) {
|
||||
if (data1[i] > 0. || data2[i] > 0.) {
|
||||
m_values[i] = 1.0;
|
||||
|
@ -32,7 +32,7 @@ void SubCondition::_calculate() {
|
||||
}
|
||||
|
||||
if (m_cond1 && !m_cond2) {
|
||||
price_t* data = m_cond1->data();
|
||||
auto const* data = m_cond1->data();
|
||||
for (size_t i = 0, total = m_cond1->size(); i < total; i++) {
|
||||
m_values[i] = data[i];
|
||||
}
|
||||
@ -40,7 +40,7 @@ void SubCondition::_calculate() {
|
||||
}
|
||||
|
||||
if (!m_cond1 && m_cond2) {
|
||||
price_t* data = m_cond2->data();
|
||||
auto const* data = m_cond2->data();
|
||||
for (size_t i = 0, total = m_cond2->size(); i < total; i++) {
|
||||
m_values[i] = -data[i];
|
||||
}
|
||||
@ -50,10 +50,10 @@ void SubCondition::_calculate() {
|
||||
size_t total = m_kdata.size();
|
||||
HKU_ASSERT(m_cond1->size() == total && m_cond2->size() == total);
|
||||
|
||||
price_t* data1 = m_cond1->data();
|
||||
price_t* data2 = m_cond2->data();
|
||||
auto const* data1 = m_cond1->data();
|
||||
auto const* data2 = m_cond2->data();
|
||||
for (size_t i = 0; i < total; i++) {
|
||||
m_values[i] = data1[i] = data2[i];
|
||||
m_values[i] = data1[i] - data2[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace hku {
|
||||
class BoolEnvironment : public EnvironmentBase {
|
||||
public:
|
||||
BoolEnvironment();
|
||||
BoolEnvironment(const Indicator& ind);
|
||||
explicit BoolEnvironment(const Indicator& ind);
|
||||
virtual ~BoolEnvironment();
|
||||
|
||||
virtual void _calculate() override;
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
* @brief 指定名称的构造函数
|
||||
* @param name 名称
|
||||
*/
|
||||
Portfolio(const string& name);
|
||||
explicit Portfolio(const string& name);
|
||||
|
||||
/**
|
||||
* @brief 构造函数
|
||||
|
@ -17,7 +17,7 @@ namespace hku {
|
||||
class SingleSignal : public SignalBase {
|
||||
public:
|
||||
SingleSignal();
|
||||
SingleSignal(const Indicator& ind);
|
||||
explicit SingleSignal(const Indicator& ind);
|
||||
virtual ~SingleSignal();
|
||||
|
||||
virtual SignalPtr _clone() override;
|
||||
|
@ -17,7 +17,7 @@ namespace hku {
|
||||
class SingleSignal2 : public SignalBase {
|
||||
public:
|
||||
SingleSignal2();
|
||||
SingleSignal2(const Indicator&);
|
||||
explicit SingleSignal2(const Indicator&);
|
||||
virtual ~SingleSignal2();
|
||||
|
||||
virtual SignalPtr _clone() override;
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
System();
|
||||
|
||||
/** 指定系统名称的构造函数 */
|
||||
System(const string& name);
|
||||
explicit System(const string& name);
|
||||
|
||||
/**
|
||||
* @brief 构造函数
|
||||
|
@ -39,9 +39,7 @@ private:
|
||||
|
||||
void ParsingError::append(size_t lineno, const std::string& line) {
|
||||
m_info << "\n\t[line " << lineno << "] " << line;
|
||||
if (!m_haveError) {
|
||||
m_haveError = true;
|
||||
}
|
||||
}
|
||||
|
||||
IniParser::IniParser() {}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
if (pos != std::string::npos) {
|
||||
m_orderby_inner = fmt::format("{}, id ASC", m_where.substr(pos));
|
||||
m_orderby_outer = m_orderby_inner;
|
||||
m_where = m_where.substr(0, pos);
|
||||
m_where = m_where.erase(pos, std::string::npos);
|
||||
} else {
|
||||
m_orderby_inner = "ORDER BY id";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user