Hikyuu
LoanRecord.h
浏览该文件的文档.
1 /*
2  * LoanRecord.h
3  *
4  * Created on: 2013-5-24
5  * Author: fasiondog
6  */
7 
8 #ifndef LOANRECORD_H_
9 #define LOANRECORD_H_
10 
11 #include "../DataType.h"
12 #include "../config.h"
13 
14 #if HKU_SUPPORT_SERIALIZATION
15 #include <boost/serialization/nvp.hpp>
16 #include <boost/serialization/split_free.hpp>
17 #endif
18 
19 namespace hku {
20 
26 public:
27  LoanRecord(): datetime(Null<Datetime>()), value(0.0) {}
28  LoanRecord(const Datetime& datetime, price_t value):
29  datetime(datetime), value(value) {}
30 
33 
34 #if HKU_SUPPORT_SERIALIZATION
35 private:
36  friend class boost::serialization::access;
37  template<class Archive>
38  void save(Archive & ar, const unsigned int version) const {
39  namespace bs = boost::serialization;
40  hku::hku_uint64 date_number = datetime.number();
41  ar & bs::make_nvp("datetime", date_number);
42  ar & BOOST_SERIALIZATION_NVP(value);
43  }
44 
45  template<class Archive>
46  void load(Archive & ar, const unsigned int version) {
47  namespace bs = boost::serialization;
48  hku::hku_uint64 date_number;
49  ar & bs::make_nvp("datetime", date_number);
50  datetime = Datetime(date_number);
51  ar & BOOST_SERIALIZATION_NVP(value);
52  }
53 
54  BOOST_SERIALIZATION_SPLIT_MEMBER()
55 #endif
56 };
57 
58 typedef vector<LoanRecord> LoanRecordList;
59 
60 HKU_API std::ostream & operator<<(std::ostream &, const LoanRecord&);
61 
62 } /* namespace hku */
63 #endif /* LOANRECORD_H_ */
unsigned long long number() const
返回如YYYYMMDDhhmmss格式的数字,方便比较操作, Null<Datetime>()对应的 number 为 Null<unsigned long lo...
Definition: Datetime.cpp:71
LoanRecord(const Datetime &datetime, price_t value)
Definition: LoanRecord.h:28
借款记录(融资记录)
Definition: LoanRecord.h:25
提供指定给定类型的Null值
Definition: Null.h:22
日期类型
Definition: Datetime.h:33
void load(Archive &ar, hku::Block &blk, unsigned int version)
Definition: Block_serialization.h:34
Definition: Block_serialization.h:18
#define HKU_API
Definition: DataType.h:12
void save(Archive &ar, const hku::Block &blk, unsigned int version)
Definition: Block_serialization.h:20
HKU_API std::ostream & operator<<(std::ostream &os, const Block &blk)
Definition: Block.cpp:13
double price_t
Definition: DataType.h:53
vector< LoanRecord > LoanRecordList
Definition: LoanRecord.h:58
LoanRecord()
Definition: LoanRecord.h:27
Datetime datetime
Definition: LoanRecord.h:31
unsigned long long hku_uint64
Definition: DataType.h:46
Hikyuu核心命名空间,包含股票数据的管理、指标实现、交易系统框架等
Definition: Block.cpp:11
price_t value
Definition: LoanRecord.h:32