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