mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-02 03:48:19 +08:00
fixed compile on linux; clear warning
This commit is contained in:
parent
1b9d9081c9
commit
978c49e7ee
@ -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;
|
||||
|
@ -43,7 +43,7 @@ void GlobalInitializer::init() {
|
||||
|
||||
initLogger();
|
||||
DataDriverFactory::init();
|
||||
auto& sm = StockManager::instance();
|
||||
StockManager::instance();
|
||||
}
|
||||
|
||||
void GlobalInitializer::clean() {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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 long(无符号64位整型)的Null值
|
||||
*/
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
|
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user