2015-01-07 01:26:14 +08:00
|
|
|
|
/*
|
|
|
|
|
* _KRecord.cpp
|
|
|
|
|
*
|
|
|
|
|
* Created on: 2012-9-28
|
|
|
|
|
* Author: fasiondog
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <hikyuu/serialization/KRecord_serialization.h>
|
2023-12-27 02:16:10 +08:00
|
|
|
|
#include "pybind_utils.h"
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
using namespace hku;
|
2023-12-27 02:16:10 +08:00
|
|
|
|
namespace py = pybind11;
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
2022-02-21 22:23:52 +08:00
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
|
#pragma warning(disable : 4267)
|
|
|
|
|
#endif
|
|
|
|
|
|
2015-01-07 01:26:14 +08:00
|
|
|
|
bool (*krecord_eq)(const KRecord&, const KRecord&) = operator==;
|
2023-10-29 18:25:06 +08:00
|
|
|
|
bool (*krecord_ne)(const KRecord&, const KRecord&) = operator!=;
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
2023-12-27 02:16:10 +08:00
|
|
|
|
void export_KReord(py::module& m) {
|
|
|
|
|
py::class_<KRecord>(m, "KRecord", "K线记录,组成K线数据,属性可读写")
|
|
|
|
|
.def(py::init<>())
|
|
|
|
|
.def(py::init<const Datetime&>())
|
|
|
|
|
.def(py::init<const Datetime&, price_t, price_t, price_t, price_t, price_t, price_t>())
|
|
|
|
|
|
2023-12-30 14:25:48 +08:00
|
|
|
|
.def("__str__", to_py_str<KRecord>)
|
|
|
|
|
.def("__repr__", to_py_str<KRecord>)
|
2020-07-04 23:54:02 +08:00
|
|
|
|
|
2020-07-12 20:46:34 +08:00
|
|
|
|
.def_readwrite("datetime", &KRecord::datetime, "时间")
|
2020-07-04 23:54:02 +08:00
|
|
|
|
.def_readwrite("open", &KRecord::openPrice, "开盘价")
|
|
|
|
|
.def_readwrite("high", &KRecord::highPrice, "最高价")
|
|
|
|
|
.def_readwrite("low", &KRecord::lowPrice, "最低价")
|
|
|
|
|
.def_readwrite("close", &KRecord::closePrice, "收盘价")
|
|
|
|
|
.def_readwrite("amount", &KRecord::transAmount, "成交金额")
|
|
|
|
|
.def_readwrite("volume", &KRecord::transCount, "成交量")
|
|
|
|
|
|
2020-07-04 00:15:54 +08:00
|
|
|
|
.def("__eq__", krecord_eq)
|
2023-10-29 18:25:06 +08:00
|
|
|
|
.def("__ne__", krecord_ne)
|
|
|
|
|
|
2023-12-27 02:16:10 +08:00
|
|
|
|
DEF_PICKLE(KRecord);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
}
|