fixed compile on linux; clear warning

This commit is contained in:
fasiondog 2020-10-14 00:18:18 +08:00
parent 1b9d9081c9
commit 978c49e7ee
10 changed files with 23 additions and 13 deletions

View File

@ -21,7 +21,6 @@
#include <stdio.h>
#include <cstdint>
#include <string_view>
#include <iostream>
#include <list>
#include <cmath>
@ -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;

View File

@ -43,7 +43,7 @@ void GlobalInitializer::init() {
initLogger();
DataDriverFactory::init();
auto& sm = StockManager::instance();
StockManager::instance();
}
void GlobalInitializer::clean() {

View File

@ -36,10 +36,7 @@ bool MySQLBaseInfoDriver::_init() {
connect_param.set<string>("db", getParamFromOther<string>(m_params, "db", "hku_base"));
string port_str = getParamFromOther<string>(m_params, "port", "3306");
unsigned int port = boost::lexical_cast<unsigned int>(port_str);
HKU_TRACE("MYSQL host: {}", host);
HKU_TRACE("MYSQL port: {}", port);
HKU_TRACE("MYSQL database: {}", database);
connect_param.set<int>("port", port);
m_pool = new ConnectPool<MySQLConnect>(connect_param);
return true;
}

View File

@ -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);

View File

@ -29,6 +29,7 @@ bool MySQLKDataDriver::_init() {
connect_param.set<string>("pwd", getParamFromOther<string>(m_params, "pwd", ""));
string port_str = getParamFromOther<string>(m_params, "port", "3306");
unsigned int port = boost::lexical_cast<unsigned int>(port_str);
connect_param.set<int>("port", port);
m_pool = new ConnectPool<MySQLConnect>(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,

View File

@ -111,7 +111,6 @@ price_t AllocateFundsBase::_getTotalFunds(const std::list<SYSPtr>& running_list)
}
// 加上当前总账户现金余额
int precision = m_shadow_tm->getParam<int>("precision");
total_value =
roundDown(total_value + m_shadow_tm->currentCash(), m_shadow_tm->getParam<int>("precision"));
return total_value;

View File

@ -69,6 +69,20 @@ public:
}
};
#if !defined(_MSC_VER)
/**
* int64_t Null值
*/
template <>
class Null<int64_t> {
public:
Null() {}
operator int64_t() {
return (std::numeric_limits<int64_t>::max)();
}
};
#endif
/**
* unsigned long long64Null值
*/

View File

@ -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));

View File

@ -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

View File

@ -136,7 +136,6 @@ BOOST_PYTHON_MODULE(core) {
:return: Stock()
:rtype: Stock)");
int64_t null_int = Null<int64_t>();
py::def(
"get_kdata", Py_GetKData,
(py::arg("market_code"), py::arg("start") = py::long_(0), py::arg("end") = py::object(),