diff --git a/hikyuu_cpp/hikyuu/trade_manage/TradeManagerBase.h b/hikyuu_cpp/hikyuu/trade_manage/TradeManagerBase.h index 46f7584d..16d255c3 100644 --- a/hikyuu_cpp/hikyuu/trade_manage/TradeManagerBase.h +++ b/hikyuu_cpp/hikyuu/trade_manage/TradeManagerBase.h @@ -322,6 +322,13 @@ public: return 0.0; } + /** + * 当前冻结现金 + */ + virtual price_t currentFrozen() const { + return 0.0; + } + /** * 获取指定日期的现金 * @note 如果不带日期参数,无法根据权息信息调整持仓 diff --git a/hikyuu_pywrap/trade_manage/_TradeManager.cpp b/hikyuu_pywrap/trade_manage/_TradeManager.cpp index b24d730f..9b65c428 100644 --- a/hikyuu_pywrap/trade_manage/_TradeManager.cpp +++ b/hikyuu_pywrap/trade_manage/_TradeManager.cpp @@ -51,6 +51,10 @@ public: PYBIND11_OVERRIDE_NAME(price_t, TradeManagerBase, "current_cash", currentCash); } + price_t currentFrozen() const override { + PYBIND11_OVERRIDE_NAME(price_t, TradeManagerBase, "current_frozen", currentFrozen); + } + price_t cash(const Datetime& datetime, KQuery::KType ktype) override { PYBIND11_OVERLOAD(price_t, TradeManagerBase, cash, datetime, ktype); } @@ -281,6 +285,10 @@ void export_TradeManager(py::module& m) { 默认情况下,TradeManager会在执行买入/卖出操作时,调用订单代理执行代理的买入/卖出动作,但这样在实盘操作时会存在问题。因为系统在计算信号指示时,需要回溯历史数据才能得到最新的信号,这样TradeManager会在历史时刻就执行买入/卖出操作,此时如果订单代理本身没有对发出买入/卖出指令的时刻进行控制,会导致代理发送错误的指令。此时,需要指定在某一个时刻之后,才允许指定订单代理的买入/卖出操作。属性 brokeLastDatetime 即用于指定该时刻。)") + .def("current_frozen", &TradeManagerBase::currentFrozen, R"(frozen(self) + + 获取当前冻结资金)") + .def("getParam", &TradeManagerBase::getParam, R"(get_param(self, name) 获取指定的参数