Skip to content

Commit

Permalink
小优化
Browse files Browse the repository at this point in the history
  • Loading branch information
fasiondog committed Feb 26, 2025
1 parent 621747d commit 39be384
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions hikyuu_cpp/hikyuu/DataType.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ using std::isinf;
using std::isnan;

inline bool iszero(price_t num) {
const price_t epsilon = std::numeric_limits<price_t>::epsilon();
return std::abs(num) < epsilon;
return std::abs(num) < std::numeric_limits<price_t>::epsilon();
}

using fmt::format;
Expand Down
5 changes: 5 additions & 0 deletions hikyuu_cpp/hikyuu/trade_sys/system/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,11 @@ TradeRecord System::_runMoment(const KRecord& today, const KRecord& src_today) {
return result;
}

if (iszero(today.transAmount) || iszero(today.transCount)) {
HKU_INFO_IF(trace, "[{}] ignore current amount == 0 or count == 0", name());
return result;
}

// 处理当前已有的交易请求
result = _processRequest(today, src_today);

Expand Down

0 comments on commit 39be384

Please sign in to comment.