mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-02 03:48:19 +08:00
Market增加开闭市时间
This commit is contained in:
parent
6bc79b79ed
commit
966391af01
9
hikyuu/data/mysql_upgrade/0003.sql
Normal file
9
hikyuu/data/mysql_upgrade/0003.sql
Normal file
@ -0,0 +1,9 @@
|
||||
ALTER TABLE `hku_base`.`market` ADD `openTime1` INT(10) UNSIGNED NULL DEFAULT NULL;
|
||||
ALTER TABLE `hku_base`.`market` ADD `closeTime1` INT(10) UNSIGNED NULL DEFAULT NULL;
|
||||
ALTER TABLE `hku_base`.`market` ADD `openTime2` INT(10) UNSIGNED NULL DEFAULT NULL;
|
||||
ALTER TABLE `hku_base`.`market` ADD `closeTime2` INT(10) UNSIGNED NULL DEFAULT NULL;
|
||||
|
||||
UPDATE `hku_base`.`market` SET `openTime1`=930, `closeTime1`=1130, `openTime2`=1300, `closeTime2`=1500 WHERE `marketid`=1;
|
||||
UPDATE `hku_base`.`market` SET `openTime1`=930, `closeTime1`=1130, `openTime2`=1300, `closeTime2`=1500 WHERE `marketid`=2;
|
||||
|
||||
UPDATE `hku_base`.`version` set `version` = 3;
|
11
hikyuu/data/sqlite_upgrade/0004.sql
Normal file
11
hikyuu/data/sqlite_upgrade/0004.sql
Normal file
@ -0,0 +1,11 @@
|
||||
BEGIN TRANSACTION;
|
||||
ALTER TABLE `Market` ADD `openTime1` INTEGER;
|
||||
ALTER TABLE `Market` ADD `closeTime1` INTEGER;
|
||||
ALTER TABLE `Market` ADD `openTime2` INTEGER;
|
||||
ALTER TABLE `Market` ADD `closeTime2` INTEGER;
|
||||
|
||||
UPDATE `Market` SET `openTime1`=930, `closeTime1`=1130, `openTime2`=1300, `closeTime2`=1500 WHERE `marketid`=1;
|
||||
UPDATE `Market` SET `openTime1`=930, `closeTime1`=1130, `openTime2`=1300, `closeTime2`=1500 WHERE `marketid`=2;
|
||||
|
||||
UPDATE `version` set `version` = 4;
|
||||
COMMIT;
|
@ -31,7 +31,8 @@ string MarketInfo::toString() const {
|
||||
|
||||
string split(", ");
|
||||
os << "MarketInfo(" << m_market << split << m_name << split << m_description << split << m_code
|
||||
<< split << m_lastDate << ")";
|
||||
<< split << m_lastDate << split << m_openTime1.minutes() << split << m_closeTime1.minutes()
|
||||
<< split << m_openTime2.minutes() << split << m_closeTime2.minutes() << ")";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
@ -57,15 +57,39 @@ public:
|
||||
return m_lastDate;
|
||||
}
|
||||
|
||||
/** 开市时间1 */
|
||||
TimeDelta openTime1() const {
|
||||
return m_openTime1;
|
||||
}
|
||||
|
||||
/** 闭市时间1 */
|
||||
TimeDelta closeTime1() const {
|
||||
return m_closeTime1;
|
||||
}
|
||||
|
||||
/** 开市时间2 */
|
||||
TimeDelta openTime2() const {
|
||||
return m_openTime2;
|
||||
}
|
||||
|
||||
/** 闭市时间2 */
|
||||
TimeDelta closeTime2() const {
|
||||
return m_closeTime2;
|
||||
}
|
||||
|
||||
/** 仅用于python的__str__ */
|
||||
string toString() const;
|
||||
|
||||
private:
|
||||
string m_market; //市场标识
|
||||
string m_name; //市场名称
|
||||
string m_description; //描述信息
|
||||
string m_code; //市场对应的指数代码,用于获取交易日历
|
||||
Datetime m_lastDate; //当前市场最后日期
|
||||
string m_market; // 市场标识
|
||||
string m_name; // 市场名称
|
||||
string m_description; // 描述信息
|
||||
string m_code; // 市场对应的指数代码,用于获取交易日历
|
||||
Datetime m_lastDate; // 当前市场最后日期
|
||||
TimeDelta m_openTime1; // 上午开市时间
|
||||
TimeDelta m_closeTime1; // 上午闭市时间
|
||||
TimeDelta m_openTime2; // 下午开市时间
|
||||
TimeDelta m_closeTime2; // 下午闭市时间
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -525,6 +525,20 @@ bool Stock::_getIndexRangeByDateFromBuffer(const KQuery& query, size_t& out_star
|
||||
return true;
|
||||
}
|
||||
|
||||
void Stock::_loadNewKRecordToBuffer(const KQuery& query) {
|
||||
if (!m_data || m_data->pKData.find(query.kType()) == m_data->pKData.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
KQuery::KType ktype = query.kType();
|
||||
KRecordList& buffer = *(m_data->pKData[ktype]);
|
||||
if (buffer.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// auto& lastRecord = buffer.back();
|
||||
}
|
||||
|
||||
KRecord Stock::getKRecord(size_t pos, KQuery::KType kType) const {
|
||||
if (!m_data)
|
||||
return Null<KRecord>();
|
||||
|
@ -203,6 +203,8 @@ private:
|
||||
bool _getIndexRangeByIndex(const KQuery&, size_t& out_start, size_t& out_end) const;
|
||||
bool _getIndexRangeByDateFromBuffer(const KQuery&, size_t&, size_t&) const;
|
||||
|
||||
void _loadNewKRecordToBuffer(const KQuery&);
|
||||
|
||||
private:
|
||||
struct HKU_API Data;
|
||||
shared_ptr<Data> m_data;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/vector.hpp>
|
||||
#include "TimeDelta_serialization.h"
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
Loading…
Reference in New Issue
Block a user