2015-01-07 01:26:14 +08:00
|
|
|
|
/*
|
|
|
|
|
* MarketInfo.h
|
|
|
|
|
*
|
|
|
|
|
* Created on: 2011-12-5
|
|
|
|
|
* Author: fasiondog
|
|
|
|
|
*/
|
|
|
|
|
|
2019-08-03 21:53:24 +08:00
|
|
|
|
#pragma once
|
2015-01-07 01:26:14 +08:00
|
|
|
|
#ifndef MARKETINFO_H_
|
|
|
|
|
#define MARKETINFO_H_
|
|
|
|
|
|
|
|
|
|
#include "DataType.h"
|
|
|
|
|
|
|
|
|
|
namespace hku {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 市场信息记录
|
|
|
|
|
* @ingroup StockManage
|
|
|
|
|
*/
|
|
|
|
|
class HKU_API MarketInfo {
|
|
|
|
|
public:
|
|
|
|
|
/** 默认构造函数,返回Null<MarketInfo>() */
|
|
|
|
|
MarketInfo();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param market 市场简称
|
|
|
|
|
* @param name 市场名称
|
|
|
|
|
* @param description 市场描述
|
|
|
|
|
* @param code 基本指数:用于读取该市场的交易日历
|
|
|
|
|
* @param lastDate 市场当前最后日期
|
|
|
|
|
*/
|
2019-11-10 19:45:57 +08:00
|
|
|
|
MarketInfo(const string& market, const string& name, const string& description,
|
|
|
|
|
const string& code, const Datetime& lastDate);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
/** 获取市场简称 */
|
2019-11-10 19:45:57 +08:00
|
|
|
|
const string& market() const {
|
|
|
|
|
return m_market;
|
|
|
|
|
}
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
/** 获取市场名称 */
|
2019-11-10 19:45:57 +08:00
|
|
|
|
const string& name() const {
|
|
|
|
|
return m_name;
|
|
|
|
|
}
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
/** 获取市场描述 */
|
2019-11-10 19:45:57 +08:00
|
|
|
|
const string& description() const {
|
|
|
|
|
return m_description;
|
|
|
|
|
}
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
/** 获取该市场对应的指数代码 */
|
2019-11-10 19:45:57 +08:00
|
|
|
|
const string& code() const {
|
|
|
|
|
return m_code;
|
|
|
|
|
}
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
/** 获取市场数据的最后更新日期 */
|
2019-11-10 19:45:57 +08:00
|
|
|
|
Datetime lastDate() const {
|
|
|
|
|
return m_lastDate;
|
|
|
|
|
}
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
2016-04-03 00:08:31 +08:00
|
|
|
|
/** 仅用于python的__str__ */
|
|
|
|
|
string toString() const;
|
|
|
|
|
|
2015-01-07 01:26:14 +08:00
|
|
|
|
private:
|
2019-11-10 19:45:57 +08:00
|
|
|
|
string m_market; //市场标识
|
|
|
|
|
string m_name; //市场名称
|
|
|
|
|
string m_description; //描述信息
|
|
|
|
|
string m_code; //市场对应的指数代码,用于获取交易日历
|
|
|
|
|
Datetime m_lastDate; //当前市场最后日期
|
2015-01-07 01:26:14 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 输出市场信息,如:
|
|
|
|
|
* MarketInfo(SH, 上海证劵交易所, 上海市场, 000001, 2011-Dec-06 00:00:00)
|
|
|
|
|
* @ingroup StockManage
|
|
|
|
|
*/
|
2019-11-10 19:45:57 +08:00
|
|
|
|
HKU_API std::ostream& operator<<(std::ostream&, const MarketInfo&);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// 关系比较函数
|
|
|
|
|
//
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
bool operator==(const MarketInfo&, const MarketInfo&);
|
|
|
|
|
bool operator!=(const MarketInfo&, const MarketInfo&);
|
|
|
|
|
|
|
|
|
|
/** 相等比较 */
|
|
|
|
|
inline bool operator==(const MarketInfo& m1, const MarketInfo& m2) {
|
|
|
|
|
return m1.market() == m2.market();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 不等比较 */
|
|
|
|
|
inline bool operator!=(const MarketInfo& m1, const MarketInfo& m2) {
|
|
|
|
|
return m1.market() != m2.market();
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-10 19:45:57 +08:00
|
|
|
|
} // namespace hku
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
#endif /* MARKETINFO_H_ */
|