summaryrefslogtreecommitdiff
path: root/python/py_commodity.cc
diff options
context:
space:
mode:
Diffstat (limited to 'python/py_commodity.cc')
-rw-r--r--python/py_commodity.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/python/py_commodity.cc b/python/py_commodity.cc
index 6611a900..df9cca18 100644
--- a/python/py_commodity.cc
+++ b/python/py_commodity.cc
@@ -40,6 +40,13 @@ namespace ledger {
using namespace boost::python;
+void py_add_price(commodity_t& commodity,
+ const datetime_t& date,
+ const amount_t& price)
+{
+ commodity.add_price(date, price);
+}
+
void export_commodity()
{
scope().attr("COMMODITY_STYLE_DEFAULTS") = COMMODITY_STYLE_DEFAULTS;
@@ -57,7 +64,9 @@ void export_commodity()
.def("drop_flags", &commodity_t::drop_flags)
- .add_property("precision", &commodity_t::precision)
+ .def("add_price", py_add_price)
+
+ .def("precision", &commodity_t::precision)
;
}