2015-01-07 01:26:14 +08:00
|
|
|
/*
|
|
|
|
* _KQuery.cpp
|
|
|
|
*
|
|
|
|
* Created on: 2012-9-28
|
|
|
|
* Author: fasiondog
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <boost/python.hpp>
|
|
|
|
#include <hikyuu/serialization/KQuery_serialization.h>
|
|
|
|
#include "pickle_support.h"
|
|
|
|
|
|
|
|
using namespace boost::python;
|
|
|
|
using namespace hku;
|
|
|
|
|
2022-01-26 02:01:28 +08:00
|
|
|
KQuery::RecoverType (KQuery::*get_recoverType)() const = &KQuery::recoverType;
|
|
|
|
void (KQuery::*set_recoverType)(KQuery::RecoverType recoverType) = &KQuery::recoverType;
|
|
|
|
|
2023-10-29 18:25:06 +08:00
|
|
|
bool (*kquery_eq)(const KQuery&, const KQuery&) = operator==;
|
|
|
|
bool (*kquery_ne)(const KQuery&, const KQuery&) = operator!=;
|
|
|
|
|
2015-01-07 01:26:14 +08:00
|
|
|
void export_KQuery() {
|
2020-06-25 15:59:37 +08:00
|
|
|
scope in_Query =
|
2020-07-08 00:18:51 +08:00
|
|
|
class_<KQuery>("Query", "K线数据查询条件", init<>())
|
2020-10-01 22:52:50 +08:00
|
|
|
.def(init<int64_t, optional<int64_t, KQuery::KType, KQuery::RecoverType> >())
|
2020-06-25 15:59:37 +08:00
|
|
|
.def(init<Datetime, optional<Datetime, KQuery::KType, KQuery::RecoverType> >())
|
2020-07-08 00:18:51 +08:00
|
|
|
|
2020-06-25 15:59:37 +08:00
|
|
|
.def(self_ns::str(self))
|
2020-07-08 00:18:51 +08:00
|
|
|
.def(self_ns::repr(self))
|
|
|
|
|
|
|
|
.add_property("start", &KQuery::start,
|
2020-10-01 22:52:50 +08:00
|
|
|
"起始索引,当按日期查询方式创建时无效,为 constant.null_int64_t")
|
2020-07-08 00:18:51 +08:00
|
|
|
.add_property("end", &KQuery::end,
|
2020-10-01 22:52:50 +08:00
|
|
|
"结束索引,当按日期查询方式创建时无效,为 constant.null_int64_t")
|
2020-07-12 20:46:34 +08:00
|
|
|
.add_property("start_datetime", &KQuery::startDatetime,
|
2020-07-08 00:18:51 +08:00
|
|
|
"起始日期,当按索引查询方式创建时无效,为 constant.null_datetime")
|
2020-07-12 20:46:34 +08:00
|
|
|
.add_property("end_datetime", &KQuery::endDatetime,
|
2020-07-08 00:18:51 +08:00
|
|
|
"结束日期,当按索引查询方式创建时无效,为 constant.null_datetime")
|
|
|
|
.add_property("query_type", &KQuery::queryType, "查询方式 Query.QueryType")
|
|
|
|
.add_property("ktype", &KQuery::kType, "查询的K线类型 Query.KType")
|
2022-01-26 02:01:28 +08:00
|
|
|
.add_property("recover_type", get_recoverType, set_recoverType,
|
|
|
|
"查询的复权类型 Query.RecoverType")
|
2020-07-08 00:18:51 +08:00
|
|
|
|
2023-10-29 18:25:06 +08:00
|
|
|
.def("__eq__", kquery_eq)
|
|
|
|
.def("__ne__", kquery_ne)
|
|
|
|
|
2015-01-07 01:26:14 +08:00
|
|
|
#if HKU_PYTHON_SUPPORT_PICKLE
|
2020-06-25 15:59:37 +08:00
|
|
|
.def_pickle(normal_pickle_suite<KQuery>())
|
2015-01-07 01:26:14 +08:00
|
|
|
#endif
|
2020-06-25 15:59:37 +08:00
|
|
|
;
|
2015-01-07 01:26:14 +08:00
|
|
|
|
2020-06-25 15:59:37 +08:00
|
|
|
enum_<KQuery::QueryType>("QueryType").value("INDEX", KQuery::INDEX).value("DATE", KQuery::DATE);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
enum_<KQuery::RecoverType>("RecoverType")
|
2020-06-25 15:59:37 +08:00
|
|
|
.value("NO_RECOVER", KQuery::NO_RECOVER)
|
|
|
|
.value("FORWARD", KQuery::FORWARD)
|
|
|
|
.value("BACKWARD", KQuery::BACKWARD)
|
|
|
|
.value("EQUAL_FORWARD", KQuery::EQUAL_FORWARD)
|
|
|
|
.value("EQUAL_BACKWARD", KQuery::EQUAL_BACKWARD)
|
|
|
|
.value("INVALID_RECOVER_TYPE", KQuery::INVALID_RECOVER_TYPE);
|
2015-01-07 01:26:14 +08:00
|
|
|
}
|