mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-01 11:28:32 +08:00
A little modification
This commit is contained in:
parent
1868afd766
commit
5321cebb29
@ -24,7 +24,7 @@ namespace hku {
|
|||||||
shared_ptr<StockManager> StockManager::m_sm;
|
shared_ptr<StockManager> StockManager::m_sm;
|
||||||
|
|
||||||
StockManager::~StockManager() {
|
StockManager::~StockManager() {
|
||||||
std::cout << "Quit Hikyuu system!" << std::endl;
|
std::cout << "Quit Hikyuu system!\n" << std::endl;
|
||||||
// Cannot use log output when exiting!
|
// Cannot use log output when exiting!
|
||||||
// HKU_TRACE("Quit Hikyuu system!\n");
|
// HKU_TRACE("Quit Hikyuu system!\n");
|
||||||
}
|
}
|
||||||
@ -59,9 +59,8 @@ Parameter default_other_param() {
|
|||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StockManager::init(const Parameter& baseInfoParam, const Parameter& blockParam,
|
void StockManager::init(const Parameter& baseInfoParam, const Parameter& blockParam, const Parameter& kdataParam,
|
||||||
const Parameter& kdataParam, const Parameter& preloadParam,
|
const Parameter& preloadParam, const Parameter& hikyuuParam) {
|
||||||
const Parameter& hikyuuParam) {
|
|
||||||
m_baseInfoDriverParam = baseInfoParam;
|
m_baseInfoDriverParam = baseInfoParam;
|
||||||
m_blockDriverParam = blockParam;
|
m_blockDriverParam = blockParam;
|
||||||
m_kdataDriverParam = kdataParam;
|
m_kdataDriverParam = kdataParam;
|
||||||
@ -113,8 +112,7 @@ void StockManager::init(const Parameter& baseInfoParam, const Parameter& blockPa
|
|||||||
setKDataDriver(kdata_driver);
|
setKDataDriver(kdata_driver);
|
||||||
|
|
||||||
// add special Market, for temp csv file
|
// add special Market, for temp csv file
|
||||||
m_marketInfoDict["TMP"] =
|
m_marketInfoDict["TMP"] = MarketInfo("TMP", "Temp Csv file", "temp load from csv file", "000001", Null<Datetime>());
|
||||||
MarketInfo("TMP", "Temp Csv file", "temp load from csv file", "000001", Null<Datetime>());
|
|
||||||
|
|
||||||
std::chrono::duration<double> sec = std::chrono::system_clock::now() - start_time;
|
std::chrono::duration<double> sec = std::chrono::system_clock::now() - start_time;
|
||||||
HKU_INFO("{:<.2f}s Loaded Data.", sec.count());
|
HKU_INFO("{:<.2f}s Loaded Data.", sec.count());
|
||||||
@ -339,13 +337,13 @@ DatetimeList StockManager::getTradingCalendar(const KQuery& query, const string&
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stock StockManager::addTempCsvStock(const string& code, const string& day_filename,
|
Stock StockManager::addTempCsvStock(const string& code, const string& day_filename, const string& min_filename,
|
||||||
const string& min_filename, price_t tick, price_t tickValue,
|
price_t tick, price_t tickValue, int precision, size_t minTradeNumber,
|
||||||
int precision, size_t minTradeNumber, size_t maxTradeNumber) {
|
size_t maxTradeNumber) {
|
||||||
string new_code(code);
|
string new_code(code);
|
||||||
to_upper(new_code);
|
to_upper(new_code);
|
||||||
Stock result("TMP", new_code, day_filename, STOCKTYPE_TMP, true, Datetime(199901010000),
|
Stock result("TMP", new_code, day_filename, STOCKTYPE_TMP, true, Datetime(199901010000), Null<Datetime>(), tick,
|
||||||
Null<Datetime>(), tick, tickValue, precision, minTradeNumber, maxTradeNumber);
|
tickValue, precision, minTradeNumber, maxTradeNumber);
|
||||||
|
|
||||||
KDataTempCsvDriver* p = new KDataTempCsvDriver(day_filename, min_filename);
|
KDataTempCsvDriver* p = new KDataTempCsvDriver(day_filename, min_filename);
|
||||||
result.setKDataDriver(KDataDriverPtr(p));
|
result.setKDataDriver(KDataDriverPtr(p));
|
||||||
|
@ -62,17 +62,16 @@ namespace hku {
|
|||||||
#define SPEND_TIME(id) \
|
#define SPEND_TIME(id) \
|
||||||
std::stringstream sptmsg_buf_##id(std::stringstream::out); \
|
std::stringstream sptmsg_buf_##id(std::stringstream::out); \
|
||||||
sptmsg_buf_##id << #id << " (" << __FILE__ << ":" << __LINE__ << ")"; \
|
sptmsg_buf_##id << #id << " (" << __FILE__ << ":" << __LINE__ << ")"; \
|
||||||
SpendTimer test_spend_timer_##id(sptmsg_buf_##id.str());
|
hku::SpendTimer test_spend_timer_##id(sptmsg_buf_##id.str());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代码执行耗时计时器,附带输出信息
|
* 代码执行耗时计时器,附带输出信息
|
||||||
* @param id 自定义耗时计时器id
|
* @param id 自定义耗时计时器id
|
||||||
* @param ... 符合 fmt::format 方式的输出信息
|
* @param ... 符合 fmt::format 方式的输出信息
|
||||||
*/
|
*/
|
||||||
#define SPEND_TIME_MSG(id, ...) \
|
#define SPEND_TIME_MSG(id, ...) \
|
||||||
string msg_##id = fmt::format(__VA_ARGS__); \
|
std::string msg_##id = fmt::format(__VA_ARGS__); \
|
||||||
SpendTimer test_spend_timer_##id( \
|
hku::SpendTimer test_spend_timer_##id(fmt::format("{} {} ({}:{})", #id, msg_##id, __FILE__, __LINE__));
|
||||||
fmt::format("{} {} ({}:{})", #id, msg_##id, __FILE__, __LINE__));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用于动态控制当前代码块及其子块中的耗时计时器,主要用于测试代码中关闭和开启部分耗时统计
|
* 用于动态控制当前代码块及其子块中的耗时计时器,主要用于测试代码中关闭和开启部分耗时统计
|
||||||
@ -95,8 +94,7 @@ public:
|
|||||||
* 构造函数,记录当前系统时间
|
* 构造函数,记录当前系统时间
|
||||||
* @param msg 辅导输出信息
|
* @param msg 辅导输出信息
|
||||||
*/
|
*/
|
||||||
explicit SpendTimer(const std::string& msg)
|
explicit SpendTimer(const std::string& msg) : m_msg(msg), m_start_time(std::chrono::steady_clock::now()) {}
|
||||||
: m_msg(msg), m_start_time(std::chrono::steady_clock::now()) {}
|
|
||||||
|
|
||||||
/** 析构函数,计算从构造至析构所消耗的时间,并打印输出 */
|
/** 析构函数,计算从构造至析构所消耗的时间,并打印输出 */
|
||||||
virtual ~SpendTimer() {
|
virtual ~SpendTimer() {
|
||||||
|
Loading…
Reference in New Issue
Block a user