2016-04-03 00:08:31 +08:00
|
|
|
/*
|
|
|
|
* _Portfolio.cpp
|
|
|
|
*
|
|
|
|
* Created on: 2016年3月29日
|
2016-04-14 01:36:53 +08:00
|
|
|
* Author: fasiondog
|
2016-04-03 00:08:31 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <boost/python.hpp>
|
|
|
|
#include <hikyuu/trade_sys/portfolio/build_in.h>
|
2017-07-23 02:37:26 +08:00
|
|
|
#include "../_Parameter.h"
|
2016-04-03 00:08:31 +08:00
|
|
|
#include "../pickle_support.h"
|
|
|
|
|
|
|
|
using namespace boost::python;
|
|
|
|
using namespace hku;
|
|
|
|
|
2018-01-13 10:55:38 +08:00
|
|
|
BOOST_PYTHON_FUNCTION_OVERLOADS(PF_Simple_overload, PF_Simple, 0, 3);
|
|
|
|
|
2017-06-17 16:59:15 +08:00
|
|
|
void (Portfolio::*pf_set_name)(const string&) = &Portfolio::name;
|
|
|
|
string (Portfolio::*pf_get_name)() const= &Portfolio::name;
|
2016-04-03 00:08:31 +08:00
|
|
|
|
|
|
|
void export_Portfolio() {
|
2018-01-13 10:55:38 +08:00
|
|
|
|
|
|
|
def("PF_Simple", PF_Simple, PF_Simple_overload());
|
|
|
|
|
2016-04-03 00:08:31 +08:00
|
|
|
class_<Portfolio>("Portfolio", init<>())
|
|
|
|
.def(init<const string&>())
|
|
|
|
.def(init<const TradeManagerPtr&,
|
|
|
|
const SystemPtr&,
|
2018-01-12 01:56:05 +08:00
|
|
|
const SelectorPtr&>())
|
2016-04-03 00:08:31 +08:00
|
|
|
.def(self_ns::str(self))
|
2018-01-12 01:56:05 +08:00
|
|
|
.def("getParam", &Portfolio::getParam<boost::any>)
|
|
|
|
.def("setParam", &Portfolio::setParam<object>)
|
|
|
|
|
2017-06-17 16:59:15 +08:00
|
|
|
.add_property("name", pf_get_name, pf_set_name)
|
2016-04-03 00:08:31 +08:00
|
|
|
.add_property("tm", &Portfolio::getTM, &Portfolio::setTM)
|
|
|
|
.add_property("sys", &Portfolio::getSYS, &Portfolio::setSYS)
|
2016-04-18 19:54:42 +08:00
|
|
|
.add_property("se", &Portfolio::getSE, &Portfolio::setSE)
|
2016-04-03 00:08:31 +08:00
|
|
|
.def("addStock", &Portfolio::addStock)
|
|
|
|
.def("addStockList", &Portfolio::addStockList)
|
|
|
|
.def("run", &Portfolio::run)
|
|
|
|
#if HKU_PYTHON_SUPPORT_PICKLE
|
|
|
|
.def_pickle(name_init_pickle_suite<Portfolio>())
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
|
|
|
register_ptr_to_python<PortfolioPtr>();
|
|
|
|
}
|
|
|
|
|
|
|
|
|