Hikyuu
StockTypeInfo.h
浏览该文件的文档.
1 /*
2  * StockTypeInfo.h
3  *
4  * Created on: 2011-12-12
5  * Author: fasiondog
6  */
7 
8 #ifndef STOCKTYPEINFO_H_
9 #define STOCKTYPEINFO_H_
10 
11 #include "DataType.h"
12 
13 namespace hku {
14 
15 #define STOCKTYPE_BLOCK 0
16 #define STOCKTYPE_A 1
17 #define STOCKTYPE_INDEX 2
18 #define STOCKTYPE_B 3
19 #define STOCKTYPE_FUND 4
20 #define STOCKTYPE_ETF 5
21 #define STOCKTYPE_ND 6
22 #define STOCKTYPE_BOND 7
23 #define STOCKTYPE_GEM 8
24 #define STOCKTYPE_BTC 9
25 
26 #define STOCKTYPE_TMP 999
27 
28 
33 public:
35  StockTypeInfo();
36  StockTypeInfo(hku_uint32, const string&, price_t, price_t,
37  int, size_t, size_t);
38 
40  hku_uint32 type() const { return m_type; }
41 
43  const string& description() const { return m_description; }
44 
46  price_t tick() const { return m_tick; }
47 
49  price_t tickValue() const { return m_tickValue; }
50 
52  price_t unit() const { return m_unit;}
53 
55  int precision() const { return m_precision; }
56 
58  size_t minTradeNumber() const { return m_minTradeNumber; }
59 
61  size_t maxTradeNumber() const { return m_maxTradeNumber; }
62 
64  string toString() const;
65 
66 private:
67  hku_uint32 m_type; //证券类型
68  string m_description; //描述信息
69  price_t m_tick; //最小跳动量
70  price_t m_tickValue; //每一个tick价格
71  price_t m_unit; //每最小变动量价格,即单位价格 = tickValue/tick
72  int m_precision; //价格精度
73  size_t m_minTradeNumber; //每笔最小交易量
74  size_t m_maxTradeNumber; //每笔最大交易量
75 };
76 
77 
83 HKU_API std::ostream & operator<<(std::ostream &, const StockTypeInfo&);
84 
85 
87 //
88 // 关系比较函数
89 //
91 bool operator==(const StockTypeInfo&, const StockTypeInfo&);
92 bool operator!=(const StockTypeInfo&, const StockTypeInfo&);
93 
95 inline bool operator==(const StockTypeInfo& m1, const StockTypeInfo& m2) {
96  return m1.type() == m2.type();
97 }
98 
100 inline bool operator!=(const StockTypeInfo& m1, const StockTypeInfo& m2) {
101  return m1.type() != m2.type();
102 }
103 
104 
105 } /* namespace hikyuu */
106 #endif /* STOCKTYPEINFO_H_ */
unsigned hku_uint32
Definition: DataType.h:48
证券类型信息
Definition: StockTypeInfo.h:32
int precision() const
获取价格精度
Definition: StockTypeInfo.h:55
size_t maxTradeNumber() const
获取每笔最大交易数量
Definition: StockTypeInfo.h:61
size_t minTradeNumber() const
获取每笔最小交易数量
Definition: StockTypeInfo.h:58
bool operator!=(const Datetime &, const Datetime &)
Definition: Datetime.h:205
#define HKU_API
Definition: DataType.h:12
price_t tick() const
获取最小跳动量
Definition: StockTypeInfo.h:46
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
Hikyuu核心命名空间,包含股票数据的管理、指标实现、交易系统框架等
Definition: Block.cpp:11
const string & description() const
获取证券类型描述信息
Definition: StockTypeInfo.h:43
price_t tickValue() const
每tick价格
Definition: StockTypeInfo.h:49
hku_uint32 type() const
获取证券类型
Definition: StockTypeInfo.h:40
price_t unit() const
每单位价格 = tickValue / tick
Definition: StockTypeInfo.h:52