Skip to content

Commit 39be384

Browse files
committed
小优化
1 parent 621747d commit 39be384

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

hikyuu_cpp/hikyuu/DataType.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ using std::isinf;
149149
using std::isnan;
150150

151151
inline bool iszero(price_t num) {
152-
const price_t epsilon = std::numeric_limits<price_t>::epsilon();
153-
return std::abs(num) < epsilon;
152+
return std::abs(num) < std::numeric_limits<price_t>::epsilon();
154153
}
155154

156155
using fmt::format;

hikyuu_cpp/hikyuu/trade_sys/system/System.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,11 @@ TradeRecord System::_runMoment(const KRecord& today, const KRecord& src_today) {
475475
return result;
476476
}
477477

478+
if (iszero(today.transAmount) || iszero(today.transCount)) {
479+
HKU_INFO_IF(trace, "[{}] ignore current amount == 0 or count == 0", name());
480+
return result;
481+
}
482+
478483
// 处理当前已有的交易请求
479484
result = _processRequest(today, src_today);
480485

0 commit comments

Comments
 (0)