Hikyuu
StockWeight.h
浏览该文件的文档.
1 /*
2  * StockWeight.h
3  *
4  * Created on: 2011-12-9
5  * Author: fasiondog
6  */
7 
8 #ifndef STOCKWEIGHT_H_
9 #define STOCKWEIGHT_H_
10 
11 #include "DataType.h"
12 
13 namespace hku {
14 
20 public:
22  StockWeight();
23 
24  StockWeight(const Datetime& datetime);
25 
26  StockWeight(const Datetime& datetime, price_t countAsGift,
27  price_t countForSell, price_t priceForSell,
28  price_t bonus, price_t increasement,
29  price_t totalCount, price_t freeCount);
30 
32  Datetime datetime() const { return m_datetime; }
33 
35  price_t countAsGift() const { return m_countAsGift; }
36 
38  price_t countForSell() const { return m_countForSell; }
39 
41  price_t priceForSell() const { return m_priceForSell; }
42 
44  price_t bonus() const { return m_bonus; }
45 
47  price_t increasement() const { return m_increasement; }
48 
50  price_t totalCount() const { return m_totalCount; }
51 
53  price_t freeCount() const { return m_freeCount; }
54 
55 private:
56  Datetime m_datetime; //权息日期
57  price_t m_countAsGift; //每10股送X股
58  price_t m_countForSell; //每10股配X股
59  price_t m_priceForSell; //配股价
60  price_t m_bonus; //每10股红利
61  price_t m_increasement; //每10股转增X股
62  price_t m_totalCount; //总股本(万股)
63  price_t m_freeCount; //流通股(万股)
64 };
65 
66 
68 typedef vector<StockWeight> StockWeightList;
69 
70 
76 HKU_API std::ostream & operator<<(std::ostream &, const StockWeight&);
77 
78 
80 //
81 // 关系比较函数
82 //
84 bool operator==(const StockWeight&, const StockWeight&);
85 bool operator!=(const StockWeight&, const StockWeight&);
86 bool operator>(const StockWeight&, const StockWeight&);
87 bool operator<(const StockWeight&, const StockWeight&);
88 bool operator>=(const StockWeight&, const StockWeight&);
89 bool operator<=(const StockWeight&, const StockWeight&);
90 
91 /* 相等比较, 仅根据日期判断 */
92 inline bool operator==(const StockWeight& m1, const StockWeight& m2) {
93  return m1.datetime() == m2.datetime();
94 }
95 
96 /* 不等比较, 仅根据日期判断 */
97 inline bool operator!=(const StockWeight& m1, const StockWeight& m2) {
98  return m1.datetime() != m2.datetime();
99 }
100 
101 /* 大于比较, 仅根据日期判断 */
102 inline bool operator>(const StockWeight& m1, const StockWeight& m2) {
103  return m1.datetime() > m2.datetime();
104 }
105 
106 /* 小于比较, 仅根据日期判断 */
107 inline bool operator<(const StockWeight& m1, const StockWeight& m2) {
108  return m1.datetime() < m2.datetime();
109 }
110 
111 /* 大于等于比较, 仅根据日期判断 */
112 inline bool operator>=(const StockWeight& m1, const StockWeight& m2) {
113  return m1.datetime() >= m2.datetime();
114 }
115 
116 /* 小于等于比较, 仅根据日期判断 */
117 inline bool operator<=(const StockWeight& m1, const StockWeight& m2) {
118  return m1.datetime() <= m2.datetime();
119 }
120 
122 } /* namespace hikyuu */
123 #endif /* STOCKWEIGHT_H_ */
price_t totalCount() const
总股本(万股)
Definition: StockWeight.h:50
日期类型
Definition: Datetime.h:33
price_t countForSell() const
每10股配X股
Definition: StockWeight.h:38
bool operator!=(const Datetime &, const Datetime &)
Definition: Datetime.h:205
#define HKU_API
Definition: DataType.h:12
price_t bonus() const
每10股红利
Definition: StockWeight.h:44
bool operator>(const Datetime &, const Datetime &)
Definition: Datetime.h:209
HKU_API std::ostream & operator<<(std::ostream &os, const Block &blk)
Definition: Block.cpp:13
double price_t
Definition: DataType.h:53
bool operator==(const Datetime &, const Datetime &)
Definition: Datetime.h:201
price_t increasement() const
每10股转增X股
Definition: StockWeight.h:47
price_t countAsGift() const
每10股送X股
Definition: StockWeight.h:35
vector< StockWeight > StockWeightList
Definition: StockWeight.h:68
权息数据结构
Definition: StockWeight.h:19
bool operator<(const Datetime &, const Datetime &)
Definition: Datetime.h:213
bool operator<=(const Datetime &, const Datetime &)
Definition: Datetime.h:221
price_t freeCount() const
流通股(万股)
Definition: StockWeight.h:53
price_t priceForSell() const
配股价
Definition: StockWeight.h:41
Hikyuu核心命名空间,包含股票数据的管理、指标实现、交易系统框架等
Definition: Block.cpp:11
bool operator>=(const Datetime &, const Datetime &)
Definition: Datetime.h:217
Datetime datetime() const
权息日期
Definition: StockWeight.h:32