2019-02-08 22:41:20 +08:00
|
|
|
/*
|
|
|
|
* _KRecord.cpp
|
|
|
|
*
|
2019-02-11 21:13:06 +08:00
|
|
|
* Created on: 2019-1-27
|
2019-02-08 22:41:20 +08:00
|
|
|
* Author: fasiondog
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <boost/python.hpp>
|
|
|
|
#include <hikyuu/serialization/TimeLineRecord_serialization.h>
|
|
|
|
#include "pickle_support.h"
|
|
|
|
|
|
|
|
using namespace boost::python;
|
|
|
|
using namespace hku;
|
|
|
|
|
2019-02-11 22:00:47 +08:00
|
|
|
bool (*timelinerecord_eq)(const TimeLineRecord&, const TimeLineRecord&) = operator==;
|
2019-02-08 22:41:20 +08:00
|
|
|
|
|
|
|
void export_TimeLineReord() {
|
|
|
|
class_<TimeLineRecord>("TimeLineRecord", init<>())
|
|
|
|
.def(init<const Datetime&, price_t, price_t>())
|
|
|
|
.def(self_ns::str(self))
|
|
|
|
.def_readwrite("datetime", &TimeLineRecord::datetime)
|
|
|
|
.def_readwrite("price", &TimeLineRecord::price)
|
|
|
|
.def_readwrite("vol", &TimeLineRecord::vol)
|
2019-02-11 22:00:47 +08:00
|
|
|
.def("__eq__", timelinerecord_eq)
|
2019-02-08 22:41:20 +08:00
|
|
|
#if HKU_PYTHON_SUPPORT_PICKLE
|
|
|
|
.def_pickle(normal_pickle_suite<TimeLineRecord>())
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
2019-02-11 16:33:55 +08:00
|
|
|
TimeLineList::const_reference (TimeLineList::*TimeLine_at)(TimeLineList::size_type) const = &TimeLineList::at;
|
|
|
|
void (TimeLineList::*append)(const TimeLineRecord&) = &TimeLineList::push_back;
|
|
|
|
class_<TimeLineList>("TimeLineList")
|
2019-02-09 18:25:16 +08:00
|
|
|
.def(self_ns::str(self))
|
2019-02-11 16:33:55 +08:00
|
|
|
.def("__iter__", iterator<TimeLineList>())
|
|
|
|
.def("size", &TimeLineList::size)
|
|
|
|
.def("__len__", &TimeLineList::size)
|
2019-02-09 18:25:16 +08:00
|
|
|
.def("get", TimeLine_at, return_value_policy<copy_const_reference>())
|
2019-02-08 22:41:20 +08:00
|
|
|
.def("append", append)
|
2019-02-09 18:25:16 +08:00
|
|
|
#if HKU_PYTHON_SUPPORT_PICKLE
|
2019-02-11 16:33:55 +08:00
|
|
|
.def_pickle(normal_pickle_suite<TimeLineList>())
|
2019-02-09 18:25:16 +08:00
|
|
|
#endif
|
2019-02-08 22:41:20 +08:00
|
|
|
;
|
|
|
|
|
2019-02-11 16:33:55 +08:00
|
|
|
register_ptr_to_python<TimeLineListPtr>();
|
2019-02-08 22:41:20 +08:00
|
|
|
}
|
|
|
|
|