2015-01-07 01:26:14 +08:00
|
|
|
|
/*
|
|
|
|
|
* _FundsRecord.cpp
|
|
|
|
|
*
|
|
|
|
|
* Created on: 2013-5-2
|
|
|
|
|
* Author: fasiondog
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <hikyuu/trade_manage/FundsRecord.h>
|
2023-12-27 02:51:33 +08:00
|
|
|
|
#include "../pybind_utils.h"
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
|
|
|
|
using namespace hku;
|
2023-12-27 02:51:33 +08:00
|
|
|
|
namespace py = pybind11;
|
2015-01-07 01:26:14 +08:00
|
|
|
|
|
2023-12-27 02:51:33 +08:00
|
|
|
|
void export_FundsRecord(py::module& m) {
|
|
|
|
|
py::class_<FundsRecord>(m, "FundsRecord", "当前资产情况记录")
|
|
|
|
|
.def(py::init<>())
|
|
|
|
|
.def("__str__", to_py_str<FundsRecord>)
|
|
|
|
|
.def("__repr__", to_py_str<FundsRecord>)
|
2020-07-11 19:06:32 +08:00
|
|
|
|
|
|
|
|
|
.def_readwrite("cash", &FundsRecord::cash, "当前现金(float)")
|
|
|
|
|
.def_readwrite("market_value", &FundsRecord::market_value, "当前多头市值(float)")
|
|
|
|
|
.def_readwrite("short_market_value", &FundsRecord::short_market_value,
|
|
|
|
|
"当前空头仓位市值(float)")
|
|
|
|
|
.def_readwrite("base_cash", &FundsRecord::base_cash, "当前投入本金(float)")
|
|
|
|
|
.def_readwrite("base_asset", &FundsRecord::base_asset, "当前投入的资产价值(float)")
|
|
|
|
|
.def_readwrite("borrow_cash", &FundsRecord::borrow_cash, "当前借入的资金(float),即负债")
|
|
|
|
|
.def_readwrite("borrow_asset", &FundsRecord::borrow_asset, "当前借入证券资产价值(float)")
|
|
|
|
|
|
2024-04-02 17:00:36 +08:00
|
|
|
|
.def_property_readonly("total_assets", &FundsRecord::total_assets, "总资产")
|
|
|
|
|
.def_property_readonly("net_assets", &FundsRecord::net_assets, "净资产")
|
|
|
|
|
.def_property_readonly("total_borrow", &FundsRecord::total_borrow, "总负债")
|
|
|
|
|
.def_property_readonly("total_base", &FundsRecord::total_base, "投入本值资产")
|
|
|
|
|
.def_property_readonly("profit", &FundsRecord::profit, "当前收益")
|
|
|
|
|
|
2024-01-28 23:38:03 +08:00
|
|
|
|
.def(py::self + py::self)
|
|
|
|
|
.def(py::self += py::self)
|
|
|
|
|
|
2023-12-27 02:51:33 +08:00
|
|
|
|
DEF_PICKLE(FundsRecord);
|
2015-01-07 01:26:14 +08:00
|
|
|
|
}
|