diff --git a/hikyuu_cpp/hikyuu/trade_manage/Performance.cpp b/hikyuu_cpp/hikyuu/trade_manage/Performance.cpp index 73af5181..b4e9b452 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/Performance.cpp +++ b/hikyuu_cpp/hikyuu/trade_manage/Performance.cpp @@ -72,6 +72,17 @@ Performance::Performance() { Performance::~Performance() {} +bool Performance::exist(const string& key) { + bool ret = false; + for (const auto& item : ms_keys) { + if (item == key) { + ret = true; + break; + } + } + return ret; +} + Performance& Performance::operator=(const Performance& other) { HKU_IF_RETURN(this == &other, *this); m_result = other.m_result; diff --git a/hikyuu_cpp/hikyuu/trade_manage/Performance.h b/hikyuu_cpp/hikyuu/trade_manage/Performance.h index b727b53c..6493c0b9 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/Performance.h +++ b/hikyuu_cpp/hikyuu/trade_manage/Performance.h @@ -29,6 +29,9 @@ public: Performance& operator=(const Performance& other); Performance& operator=(Performance&& other); + /** 是否为合法的统计项 */ + static bool exist(const string& key); + /** 复位,清除已计算的结果 */ void reset();