diff --git a/hikyuu_cpp/hikyuu/DataType.h b/hikyuu_cpp/hikyuu/DataType.h index c0cb4ed7..8f08625c 100644 --- a/hikyuu_cpp/hikyuu/DataType.h +++ b/hikyuu_cpp/hikyuu/DataType.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -95,7 +94,6 @@ using std::uint8_t; typedef double price_t; using std::string; -using std::string_view; using std::enable_shared_from_this; using std::make_shared; diff --git a/hikyuu_cpp/hikyuu/GlobalInitializer.cpp b/hikyuu_cpp/hikyuu/GlobalInitializer.cpp index 3059a8e1..15b0a975 100644 --- a/hikyuu_cpp/hikyuu/GlobalInitializer.cpp +++ b/hikyuu_cpp/hikyuu/GlobalInitializer.cpp @@ -43,7 +43,7 @@ void GlobalInitializer::init() { initLogger(); DataDriverFactory::init(); - auto& sm = StockManager::instance(); + StockManager::instance(); } void GlobalInitializer::clean() { diff --git a/hikyuu_cpp/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.cpp b/hikyuu_cpp/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.cpp index d8c8b270..579e0a63 100644 --- a/hikyuu_cpp/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.cpp +++ b/hikyuu_cpp/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.cpp @@ -36,10 +36,7 @@ bool MySQLBaseInfoDriver::_init() { connect_param.set("db", getParamFromOther(m_params, "db", "hku_base")); string port_str = getParamFromOther(m_params, "port", "3306"); unsigned int port = boost::lexical_cast(port_str); - HKU_TRACE("MYSQL host: {}", host); - HKU_TRACE("MYSQL port: {}", port); - HKU_TRACE("MYSQL database: {}", database); - + connect_param.set("port", port); m_pool = new ConnectPool(connect_param); return true; } diff --git a/hikyuu_cpp/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.cpp b/hikyuu_cpp/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.cpp index ef06aef5..06cb3172 100644 --- a/hikyuu_cpp/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.cpp +++ b/hikyuu_cpp/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.cpp @@ -934,7 +934,6 @@ TransList H5KDataDriver::_getTransList(const string& market, const string& code, return result; } - H5TransRecord* pBuf = NULL; try { string tablename(market + code); CHECK_DATASET_EXISTS_RET(group, tablename, result); @@ -1118,7 +1117,6 @@ TransList H5KDataDriver::_getTransList(const string& market, const string& code, return result; } - H5TransRecord* pBuf = NULL; try { string tablename(market + code); CHECK_DATASET_EXISTS_RET(group, tablename, result); diff --git a/hikyuu_cpp/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.cpp b/hikyuu_cpp/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.cpp index 75dba0eb..54eaf251 100644 --- a/hikyuu_cpp/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.cpp +++ b/hikyuu_cpp/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.cpp @@ -29,6 +29,7 @@ bool MySQLKDataDriver::_init() { connect_param.set("pwd", getParamFromOther(m_params, "pwd", "")); string port_str = getParamFromOther(m_params, "port", "3306"); unsigned int port = boost::lexical_cast(port_str); + connect_param.set("port", port); m_pool = new ConnectPool(connect_param); return true; } @@ -37,7 +38,7 @@ string MySQLKDataDriver ::_getTableName(const string& market, const string& code KQuery::KType ktype) { string table = fmt::format("`{}`_`{}`.`{}`", market, KQuery::getKTypeName(ktype), code); to_lower(table); - return std::move(table); + return table; } KRecordList MySQLKDataDriver::getKRecordList(const string& market, const string& code, diff --git a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.cpp b/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.cpp index c82a9486..1896f46d 100644 --- a/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.cpp +++ b/hikyuu_cpp/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.cpp @@ -111,7 +111,6 @@ price_t AllocateFundsBase::_getTotalFunds(const std::list& running_list) } // 加上当前总账户现金余额 - int precision = m_shadow_tm->getParam("precision"); total_value = roundDown(total_value + m_shadow_tm->currentCash(), m_shadow_tm->getParam("precision")); return total_value; diff --git a/hikyuu_cpp/hikyuu/utilities/Null.h b/hikyuu_cpp/hikyuu/utilities/Null.h index 5d18a335..7b63d859 100644 --- a/hikyuu_cpp/hikyuu/utilities/Null.h +++ b/hikyuu_cpp/hikyuu/utilities/Null.h @@ -69,6 +69,20 @@ public: } }; +#if !defined(_MSC_VER) +/** + * int64_t Null值 + */ +template <> +class Null { +public: + Null() {} + operator int64_t() { + return (std::numeric_limits::max)(); + } +}; +#endif + /** * 提供unsigned long long(无符号64位整型)的Null值 */ diff --git a/hikyuu_cpp/hikyuu/utilities/db_connect/mysql/MySQLConnect.cpp b/hikyuu_cpp/hikyuu/utilities/db_connect/mysql/MySQLConnect.cpp index 5c1ca5f8..945dfbb8 100755 --- a/hikyuu_cpp/hikyuu/utilities/db_connect/mysql/MySQLConnect.cpp +++ b/hikyuu_cpp/hikyuu/utilities/db_connect/mysql/MySQLConnect.cpp @@ -95,8 +95,10 @@ void MySQLConnect::exec(const string& sql_string) { mysql_free_result(result); } else { if (mysql_field_count(m_mysql) == 0) { +#if defined(_DEBUG) || defined(DEBUG) auto num_rows = mysql_affected_rows(m_mysql); HKU_TRACE("num_rows: {}", num_rows); +#endif } else { HKU_THROW("mysql_field_count error:{}! error code:{}, error msg: {}", sql_string, ret, mysql_error(m_mysql)); diff --git a/hikyuu_cpp/hikyuu/xmake.lua b/hikyuu_cpp/hikyuu/xmake.lua index 94968a3e..40a67b2a 100644 --- a/hikyuu_cpp/hikyuu/xmake.lua +++ b/hikyuu_cpp/hikyuu/xmake.lua @@ -44,7 +44,9 @@ target("hikyuu") add_includedirs("/usr/include/hdf5") add_includedirs("/usr/include/hdf5/serial") if is_arch("x86_64") then - add_linkdirs("/usr/lib64/mysql") + if os.exists("/usr/lib64/mysql") then + add_linkdirs("/usr/lib64/mysql") + end add_linkdirs("/usr/lib/x86_64-linux-gnu") add_linkdirs("/usr/lib/x86_64-linux-gnu/hdf5/serial") end diff --git a/hikyuu_pywrap/main.cpp b/hikyuu_pywrap/main.cpp index 743bb427..5ef19fc9 100644 --- a/hikyuu_pywrap/main.cpp +++ b/hikyuu_pywrap/main.cpp @@ -136,7 +136,6 @@ BOOST_PYTHON_MODULE(core) { :return: 对应的证券实例,如果实例不存在,则返回空实例,即Stock(),不抛出异常 :rtype: Stock)"); - int64_t null_int = Null(); py::def( "get_kdata", Py_GetKData, (py::arg("market_code"), py::arg("start") = py::long_(0), py::arg("end") = py::object(),