diff --git a/hikyuu_cpp/hikyuu/KData.cpp b/hikyuu_cpp/hikyuu/KData.cpp index cd198afc..2528fb50 100644 --- a/hikyuu_cpp/hikyuu/KData.cpp +++ b/hikyuu_cpp/hikyuu/KData.cpp @@ -29,7 +29,8 @@ string KData::toString() const { KData::KData(const Stock& stock, const KQuery& query) { - if (stock.isNull() || query.kType() >= KQuery::INVALID_KTYPE) { + //if (stock.isNull() || query.kType() >= KQuery::INVALID_KTYPE) { + if (stock.isNull()) { return; } if (query.kType() < KQuery::DAY) { diff --git a/hikyuu_cpp/hikyuu/KQuery.cpp b/hikyuu_cpp/hikyuu/KQuery.cpp index 8f616d94..ab07a3a9 100644 --- a/hikyuu_cpp/hikyuu/KQuery.cpp +++ b/hikyuu_cpp/hikyuu/KQuery.cpp @@ -26,7 +26,7 @@ const string KQuery::HOUR2("HOUR2"); const string KQuery::HOUR4("HOUR4"); const string KQuery::HOUR6("HOUR5"); const string KQuery::HOUR12("HOUR12"); -const string KQuery::INVALID_KTYPE("Z"); +//const string KQuery::INVALID_KTYPE("Z"); string KQuery::getQueryTypeName(QueryType queryType) { switch(queryType){ diff --git a/hikyuu_cpp/hikyuu/KQuery.h b/hikyuu_cpp/hikyuu/KQuery.h index e5cff7f9..14994094 100644 --- a/hikyuu_cpp/hikyuu/KQuery.h +++ b/hikyuu_cpp/hikyuu/KQuery.h @@ -66,7 +66,7 @@ public: static const string HOUR4; static const string HOUR6; static const string HOUR12; - static const string INVALID_KTYPE; + //static const string INVALID_KTYPE; /** * 复权类型 @@ -255,7 +255,7 @@ public: operator KQuery() { return KQuery(Null(), Null(), - KQuery::INVALID_KTYPE, + "", //KQuery::INVALID_KTYPE, KQuery::INVALID_RECOVER_TYPE, KQuery::INVALID ); diff --git a/hikyuu_cpp/hikyuu/Stock.cpp b/hikyuu_cpp/hikyuu/Stock.cpp index 21717a6e..339731cc 100644 --- a/hikyuu_cpp/hikyuu/Stock.cpp +++ b/hikyuu_cpp/hikyuu/Stock.cpp @@ -304,7 +304,8 @@ bool Stock::isNull() const { void Stock::releaseKDataBuffer(KQuery::KType kType) { - if (!m_data || kType >= KQuery::INVALID_KTYPE) + //if (!m_data || kType >= KQuery::INVALID_KTYPE) + if (!m_data) return; //if (m_data->pKData[kType]) @@ -316,7 +317,8 @@ void Stock::releaseKDataBuffer(KQuery::KType kType) { void Stock::loadKDataToBuffer(KQuery::KType kType) { - if (!m_data || kType >= KQuery::INVALID_KTYPE) + //if (!m_data || kType >= KQuery::INVALID_KTYPE) + if (!m_data) return; releaseKDataBuffer(kType); @@ -357,7 +359,8 @@ KData Stock::getKData(const KQuery& query) const { size_t Stock::getCount(KQuery::KType kType) const { - if (!m_data || kType >= KQuery::INVALID_KTYPE) + //if (!m_data || kType >= KQuery::INVALID_KTYPE) + if (!m_data) return 0; if (m_data->pKData.find(kType) != m_data->pKData.end()) @@ -418,7 +421,7 @@ Stock::getIndexRange(const KQuery& query, size_t& out_start, size_t& out_end) c return _getIndexRangeByIndex(query, out_start, out_end); if ((KQuery::DATE != query.queryType()) - || (query.kType() >= KQuery::INVALID_KTYPE) + //|| (query.kType() >= KQuery::INVALID_KTYPE) || query.startDatetime() >= query.endDatetime()) return false; diff --git a/hikyuu_cpp/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.cpp b/hikyuu_cpp/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.cpp index 18ed127f..d1da9eaa 100644 --- a/hikyuu_cpp/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.cpp +++ b/hikyuu_cpp/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.cpp @@ -130,8 +130,9 @@ void H5KDataDriver void H5KDataDriver::loadKData(const string& market, const string& code, KQuery::KType kType, size_t start_ix, size_t end_ix, KRecordListPtr out_buffer) { - if (KQuery::INVALID_KTYPE <= kType - || start_ix >= end_ix) { + //if (KQuery::INVALID_KTYPE <= kType + // || start_ix >= end_ix) { + if (start_ix >= end_ix) { return; } diff --git a/hikyuu_cpp/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.cpp b/hikyuu_cpp/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.cpp index fcd93e24..1928ba2f 100644 --- a/hikyuu_cpp/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.cpp +++ b/hikyuu_cpp/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.cpp @@ -144,7 +144,8 @@ loadKData(const string& market, const string& code, return; } - if (kType >= KQuery::INVALID_KTYPE || start_ix >= end_ix) { + //if (kType >= KQuery::INVALID_KTYPE || start_ix >= end_ix) { + if (start_ix >= end_ix) { HKU_WARN("ktype(" << kType << ") is invalid or start_ix(" << start_ix << ") >= endix(" << end_ix << ")" << func_name); return; @@ -207,10 +208,10 @@ getCount(const string& market, return result; } - if (kType >= KQuery::INVALID_KTYPE ) { + /*if (kType >= KQuery::INVALID_KTYPE ) { HKU_WARN("ktype(" << kType << ") is invalid" << func_name); return result; - } + }*/ MYSQL_RES *mysql_result; MYSQL_ROW row; @@ -329,10 +330,10 @@ getKRecord(const string& market, const string& code, return result; } - if (kType >= KQuery::INVALID_KTYPE ) { + /*if (kType >= KQuery::INVALID_KTYPE ) { HKU_WARN("ktype(" << kType << ") is invalid" << func_name); return result; - } + }*/ MYSQL_RES *mysql_result; MYSQL_ROW row; diff --git a/hikyuu_cpp/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.cpp b/hikyuu_cpp/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.cpp index 0506f2fb..0c6625a2 100644 --- a/hikyuu_cpp/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.cpp +++ b/hikyuu_cpp/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.cpp @@ -99,6 +99,8 @@ loadKData(const string& market, const string& code, _loadMinKData(market, code, ktype, start_ix, end_ix, out_buffer); } else if (ktype == KQuery::DAY) { _loadDayKData(market, code, ktype, start_ix, end_ix, out_buffer); + } else { + HKU_WARN("Don't support the ktype: " << ktype << " [TdxKDataDriver::loadKData]"); } /*switch (ktype) { case KQuery::MIN: @@ -205,6 +207,8 @@ getKRecord(const string& market, const string& code, record = _getMinKRecord(market, code, pos, ktype); } else if (ktype == KQuery::DAY) { record = _getDayKRecord(market, code, pos, ktype); + } else { + HKU_WARN("Don't support the ktype: " << ktype << " [TdxKDataDriver::getKRecord]"); } return record; @@ -533,6 +537,8 @@ _getFileName(const string& market, const string& code, KQuery::KType ktype) { filename = m_dirname + "\\" + market + "\\fzline\\" + market + code + ".lc5"; } else if (ktype == KQuery::DAY || ktype == KQuery::WEEK || ktype == KQuery::MONTH || ktype == KQuery::QUARTER || ktype == KQuery::HALFYEAR || ktype == KQuery::YEAR) { filename = m_dirname + "\\" + market + "\\lday\\" + market + code + ".day"; + } else { + HKU_WARN("Don't support this ktype: " << ktype << " [TdxKDataDriver::_getFileName]"); } return filename;