hikyuu2/hikyuu_pywrap/trade_manage/_Performance.cpp
2024-03-02 09:27:43 +08:00

53 lines
1.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* _Performance.cpp
*
* Created on: 2013-4-23
* Author: fasiondog
*/
#include <hikyuu/trade_manage/Performance.h>
#include "../pybind_utils.h"
using namespace hku;
namespace py = pybind11;
void export_Performance(py::module& m) {
py::class_<Performance>(m, "Performance", "简单绩效统计")
.def(py::init<>())
.def("reset", &Performance::reset, R"(reset(self)
)")
.def("report", &Performance::report, py::arg("tm"), py::arg("datetime") = Datetime::now(),
R"(report(self, tm[, datetime=Datetime.now()])
:param TradeManager tm:
:param Datetime datetime:
:rtype: str)")
.def("statistics", &Performance::statistics, py::arg("tm"),
py::arg("datetime") = Datetime::now(),
R"(statistics(self, tm[, datetime=Datetime.now()])
, datetime必须大于等于lastDatetime
:param TradeManager tm:
:param Datetime datetime: )")
.def("names", &Performance::names, py::return_value_policy::copy, R"(names(self)
)")
.def("values", &Performance::values, R"(values(self)
names )")
.def("__getitem__", &Performance::get,
R"(按指标名称获取指标值,必须在运行 statistics 或 report 之后生效
:param str name:
:rtype: float))");
}