summaryrefslogtreecommitdiff
path: root/src/report.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2019-08-03 13:37:58 -0700
committerJohn Wiegley <johnw@newartisans.com>2019-12-06 14:06:22 +0100
commitf77bdf19c307811d4659b6e85d147cdd5eee5ef3 (patch)
tree7a3dcae3901cb1543feed902dce256cf3b751d69 /src/report.h
parent6a140f313433e4ac21882d7995dbbb56124b4079 (diff)
downloadfork-ledger-f77bdf19c307811d4659b6e85d147cdd5eee5ef3.tar.gz
fork-ledger-f77bdf19c307811d4659b6e85d147cdd5eee5ef3.tar.bz2
fork-ledger-f77bdf19c307811d4659b6e85d147cdd5eee5ef3.zip
Add --averaged-lot-prices
This joins together lots of the same underlying, averaging the reported price and using the date of the oldest lot.
Diffstat (limited to 'src/report.h')
-rw-r--r--src/report.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/report.h b/src/report.h
index 7775e21d..5325c3a2 100644
--- a/src/report.h
+++ b/src/report.h
@@ -202,6 +202,7 @@ public:
value_t fn_to_string(call_scope_t& scope);
value_t fn_to_mask(call_scope_t& scope);
value_t fn_to_sequence(call_scope_t& scope);
+ value_t fn_averaged_lots(call_scope_t& scope);
value_t fn_now(call_scope_t&) {
return terminus;
@@ -298,6 +299,7 @@ public:
HANDLER(limit_).report(out);
HANDLER(lot_dates).report(out);
HANDLER(lot_prices).report(out);
+ HANDLER(average_lot_prices).report(out);
HANDLER(lot_notes).report(out);
HANDLER(lots).report(out);
HANDLER(lots_actual).report(out);
@@ -745,6 +747,13 @@ public:
OPTION(report_t, lot_dates);
OPTION(report_t, lot_prices);
+ OPTION_(report_t, average_lot_prices, DO() {
+ OTHER(lot_prices).on(whence);
+ OTHER(display_amount_)
+ .on(whence, "averaged_lots(display_amount)");
+ OTHER(display_total_)
+ .on(whence, "averaged_lots(display_total)");
+ });
OPTION(report_t, lot_notes);
OPTION(report_t, lots);
OPTION(report_t, lots_actual);