hikyuu2/hikyuu_pywrap/trade_manage/_Performance.cpp
2020-07-13 02:01:25 +08:00

43 lines
1.3 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 <boost/python.hpp>
#include <hikyuu/trade_manage/Performance.h>
using namespace boost::python;
using namespace hku;
void export_Performance() {
class_<Performance>("Performance", "简单绩效统计", init<>())
.def("reset", &Performance::reset, R"(reset(self)
)")
.def("report", &Performance::report, (arg("tm"), arg("datetime") = Datetime::now()),
R"(report(self, tm[, datetime=Datetime.now()])
:param TradeManager tm:
:param Datetime datetime:
:rtype: str)")
.def("statistics", &Performance::statistics, (arg("tm"), arg("datetime") = Datetime::now()),
R"(statistics(self, tm[, datetime=Datetime.now()])
, datetime必须大于等于lastDatetime
:param TradeManager tm:
:param Datetime datetime: )")
.def("__getitem__", &Performance::get,
R"(按指标名称获取指标值,必须在运行 statistics 或 report 之后生效
:param str name:
:rtype: float))");
}