Hikyuu
KRecord.h
浏览该文件的文档.
1 /*
2  * KRecord.h
3  *
4  * Created on: 2011-12-24
5  * Author: fasiondog
6  */
7 
8 #ifndef KRECORD_H_
9 #define KRECORD_H_
10 
11 #include "DataType.h"
12 
13 namespace hku {
14 
19 class KRecord {
20 public:
28 
30  : datetime(Null<Datetime>()), openPrice(0.0), highPrice(0.0),
31  lowPrice(0.0), closePrice(0.0), transAmount(0.0), transCount(0.0){ }
32 
33  KRecord(const Datetime& indate)
34  : datetime(indate),
35  openPrice(0.0), highPrice(0.0), lowPrice(0.0),
36  closePrice(0.0), transAmount(0.0), transCount(0.0) { }
37 
38  KRecord(const Datetime& date,
39  price_t openPrice, price_t highPrice,
40  price_t lowPrice, price_t closePrice,
41  price_t transAmount, price_t transCount)
42  : datetime(date),
43  openPrice(openPrice), highPrice(highPrice),
44  lowPrice(lowPrice), closePrice(closePrice),
45  transAmount(transAmount), transCount(transCount) { }
46 
47  bool isValid() const {
48  return datetime == Null<Datetime>() ? false : true;
49  }
50 };
51 
53 typedef vector<KRecord> KRecordList;
54 
56 typedef shared_ptr<KRecordList> KRecordListPtr;
57 
62 HKU_API std::ostream & operator<<(std::ostream &, const KRecord&);
63 
64 
69 bool HKU_API operator==(const KRecord& d1, const KRecord&d2);
70 
71 
72 
73 } /* namespace hikyuu */
74 #endif /* KRECORD_H_ */
price_t lowPrice
最低价
Definition: KRecord.h:24
K线数据记录
Definition: KRecord.h:19
KRecord()
Definition: KRecord.h:29
bool isValid() const
Definition: KRecord.h:47
price_t transAmount
成交金额
Definition: KRecord.h:26
price_t transCount
成交量
Definition: KRecord.h:27
提供指定给定类型的Null值
Definition: Null.h:22
日期类型
Definition: Datetime.h:33
vector< KRecord > KRecordList
Definition: KRecord.h:53
#define HKU_API
Definition: DataType.h:12
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 closePrice
最低价
Definition: KRecord.h:25
Datetime datetime
日期,格式:YYYYMMDDHHMM 如:200901010930
Definition: KRecord.h:21
shared_ptr< KRecordList > KRecordListPtr
Definition: KRecord.h:56
KRecord(const Datetime &date, price_t openPrice, price_t highPrice, price_t lowPrice, price_t closePrice, price_t transAmount, price_t transCount)
Definition: KRecord.h:38
KRecord(const Datetime &indate)
Definition: KRecord.h:33
price_t openPrice
开盘价
Definition: KRecord.h:22
Hikyuu核心命名空间,包含股票数据的管理、指标实现、交易系统框架等
Definition: Block.cpp:11
price_t highPrice
最高价
Definition: KRecord.h:23