diff options
-rw-r--r-- | src/py_amount.cc | 7 | ||||
-rw-r--r-- | src/py_value.cc | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/py_amount.cc b/src/py_amount.cc index ea69dec5..0aa8fee8 100644 --- a/src/py_amount.cc +++ b/src/py_amount.cc @@ -56,6 +56,11 @@ namespace { const datetime_t& moment) { return amount.value(moment, in_terms_of); } + boost::optional<amount_t> py_value_2d(const amount_t& amount, + const commodity_t * in_terms_of, + const date_t& moment) { + return amount.value(datetime_t(moment), in_terms_of); + } void py_parse_2(amount_t& amount, object in, unsigned char flags) { if (PyFile_Check(in.ptr())) { @@ -238,6 +243,7 @@ internal precision.")) .def("value", py_value_0) .def("value", py_value_1, args("in_terms_of")) .def("value", py_value_2, args("in_terms_of", "moment")) + .def("value", py_value_2d, args("in_terms_of", "moment")) .def("price", &amount_t::price) @@ -267,6 +273,7 @@ internal precision.")) make_function(&amount_t::set_commodity, with_custodian_and_ward<1, 2>())) .def("has_commodity", &amount_t::has_commodity) + .def("with_commodity", &amount_t::with_commodity) .def("clear_commodity", &amount_t::clear_commodity) .def("number", &amount_t::number) diff --git a/src/py_value.cc b/src/py_value.cc index efeb4340..b931f008 100644 --- a/src/py_value.cc +++ b/src/py_value.cc @@ -59,6 +59,11 @@ namespace { const datetime_t& moment) { return value.value(moment, in_terms_of); } + boost::optional<value_t> py_value_2d(const value_t& value, + const commodity_t * in_terms_of, + const date_t& moment) { + return value.value(datetime_t(moment), in_terms_of); + } PyObject * py_base_type(value_t& value) { @@ -265,6 +270,7 @@ void export_value() .def("value", py_value_0) .def("value", py_value_1, args("in_terms_of")) .def("value", py_value_2, args("in_terms_of", "moment")) + .def("value", py_value_2d, args("in_terms_of", "moment")) //.def("value", &value_t::value, value_overloads()) .def("exchange_commodities", &value_t::exchange_commodities, |