Commit Graph

146 Commits

Author SHA1 Message Date
Simon Michael
84165f5a0c ;journal: fix tests 2020-03-17 17:48:17 -07:00
Simon Michael
21fdcec6b7 journal: inclusive balance assignments now work (#1207) 2020-03-05 13:38:19 -08:00
Simon Michael
41bb7865f3 ;convert balance assertion/assignment tests to new format
And update a seemingly obsolete test description.

[ci skip]
2020-03-05 11:19:21 -08:00
Simon Michael
f18c74fff7 ;journal: a test for inclusive balance assignment, disabled (#1207)
[ci skip]
2020-03-05 11:19:04 -08:00
Simon Michael
b1f3880c3d lib: drop the file format auto-detection feature
For a long time hledger has auto-detected the file format when it's
not known, eg when reading from a file with unusual extension (like
.dat or .txt), or from standard input (-f-), or when using the include
directive (which currently ignores file extensions).

Auto-detecting has been done by trying all readers until one succeeds.
This could guess wrong in some cases, but it was so rare that it has
been working fine.

Recently, more conveniences have been added to timedot format,
increasing its overlap with journal format, which makes this kind of
auto-detection unreliable.

Auto-detection and auto-detection failures are (probably) still pretty
rare in practice. But when it does happen it's confusing, giving
misleading errors or false successes (eg printing timedot entries
instead of a journal error).

For predictability and to minimise confusion, hledger no longer tries
to guess; when there's no file extension or reader prefix, it assumes
journal format. To specify one of the other formats, you must use a
standard file extension (.timeclock, .timedot, .csv, .ssv, .tsv), or a
reader prefix (-f csv:foo.txt, -f timedot:-).

For now, the include directive still tries to autodetect
(journal/timeclock/timedot), and this can't be overridden; it will be
fixed later.

Experimental; testing and feedback welcome.
2020-03-01 14:06:29 -08:00
Simon Michael
e4a0bdff8d journal: default commodity (D) limits display precision too (#1187)
D directives are now fully equivalent to commodity directives for
setting a commodity's display style. (Previously it was equivalent to
a posting amount, so it couldn't limit the number of decimal places.)
When both kinds of directive exist, commodity directives take precedence.
When there are multiple D directives in the journal, only the last one
affects display style.
2020-02-11 09:47:26 -08:00
Simon Michael
1741b607e2 lib: more cleanup of amount canonicalisation helpers (#1187)
Stop exporting journalAmounts, overJournalAmounts, traverseJournalAmounts.
Rename journalAmounts helper to journalStyleInfluencingAmounts.

D directives are now a little better at influencing amount
canonicalisation, eg in the updated test case.
2020-02-11 09:23:04 -08:00
Simon Michael
242bf528fd ;tests: convert default commodity tests to new format
[ci skip]
2020-02-11 08:34:22 -08:00
Simon Michael
dad4d9b662 print: be sure to value all postings; -V/-X/--value now imply -x
Previously -B implied -x; now any of the valuation flags do.
This avoids a bug where print -V of a transaction with an implicit
commodity conversion would convert only some of its postings to value.

Also, more valuation tests.
2020-02-10 12:41:36 -08:00
Simon Michael
aa96b41efe print, register: add --value=then, valuing at each posting's date
Currently this will give an error with other kinds of report.
2020-02-10 08:20:39 -08:00
Simon Michael
b3711488a7 lib: apply canonical display styles to auto posting amounts too 2020-01-31 06:00:06 -08:00
Brian Wignall
c823f5b51a Get "make functest" working again 2020-01-07 15:58:54 -08:00
Brian Wignall
03e68f3925 Get "make functest" working again 2020-01-07 15:58:54 -08:00
Brian Wignall
e12b0a4f05 Get "make functest" working again 2020-01-07 15:58:54 -08:00
Brian Wignall
28f9f043e5 Get "make functest" (mostly) working again 2020-01-07 15:58:54 -08:00
Simon Michael
8f1aa0981e ;make that auto posting test independent of current date
[ci skip]
2020-01-04 17:36:57 -08:00
Aleksandar Dimitrov
f55f814155 Fix auto postings test.
Happy new year!
2020-01-02 09:54:14 -08:00
Mykola Orliuk
6dbe925eed cli: anonymize transaction code also 2019-11-18 17:42:22 -08:00
Mykola Orliuk
0a273561f7 cli: anonymize declared accounts also
Fixes simonmichael/hledger#901
2019-11-18 17:42:22 -08:00
Simon Michael
6dcddadd9f ;journal: in generated-transaction:/posting: tags, add a space before the value 2019-10-07 14:54:36 -10:00
Simon Michael
39635b2fde ;valuation: test documenting new end-date behaviour (#1083)
[ci skip]
2019-09-05 21:03:30 -07:00
Simon Michael
a7f172b085 valuation: -V/-X respects report end date, code/doc cleanups (#1083)
-V (and -X) now respects a report end date set with -e/-p/date: when
choosing the valuation date, similar to hledger 1.14 and Ledger.

This means that -V/-X aren't exactly like either --value=end or
--value=now. The "Effect of --value on reports" doc has been extended
accordingly, and much of it has been reworded and made more accurate.
2019-09-05 13:41:36 -07:00
Simon Michael
07c4b3e0ab ;tests: consolidate query tests slightly
[ci skip]
2019-07-26 23:22:46 +01:00
Simon Michael
35799142dd
Merge pull request #914 from simonmichael/rule-tags
tags for matching rule-generated txns and postings
2019-07-17 18:38:14 +01:00
Simon Michael
5ceb278296 ;journal: tests: note surprising decimal mark parsing
[ci skip]
2019-07-09 11:31:56 +01:00
Simon Michael
6c2398e4d7 close: preserve transaction prices (costs) accurately (#1035)
Transaction prices were being collapsed/misreported after close/open;
this is fixed. Now each separately-priced amount gets its own posting,
and only the last of these (for each commodity) gets a balance
assertion. Also the equity posting's amount is now always shown
explicitly, which in multicommodity situations means that multiple
equity postings are shown. The upshot is that a balance -B report
will be unchanged after closing & opening transactions.
2019-07-09 11:21:22 +01:00
Simon Michael
19ba1628bf ;print: more valuation-related tests
[ci skip]
2019-07-08 06:00:28 +01:00
Simon Michael
33d03284c3 ;valuation: more tests; document default amount style issue
[ci skip]
2019-06-17 08:19:23 -07:00
Caleb Maclennan
18e19b9ad2 ;tests: normalize tests, examples, and docs using 2spcs before comments 2019-06-13 12:12:21 -07:00
Simon Michael
aa99743096 make -V do --value=end in multiperiod reports (#329) 2019-05-24 10:30:35 -07:00
Simon Michael
37b30415d5 update valuation tests to match latest #329 scheme 2019-05-23 21:55:19 -07:00
Simon Michael
e21afc466a bal/bs/bse: -H or --cumulative now disables -T (#329)
To reduce confusion, multiperiod balance reports using -H/--historical
or --cumulative, which show end balances, no longer show a Totals
column since summing end balances generally doesn't make sense.
Also the underlying MultiBalanceReport now returns zero for those
totals when in cumulative or historical mode.
2019-05-11 20:43:28 -07:00
Simon Michael
76342a3fd0 bal/bs/cf/is: mention valuation type in report title 2019-05-09 15:39:43 -07:00
Simon Michael
fb18019212 bal: document and test --value-at with --budget (#329) 2019-05-09 12:23:51 -07:00
Simon Michael
d77fd5743d bal/bs/cf/is: support --value-at with -H; fix row/col/grand totals
This also includes a big cleanup of multiBalanceReport, which got
accidentally mingled.
2019-05-09 07:58:45 -07:00
Simon Michael
9680e894cc ;tests: fix totals in a --value-at test
[ci skip]
2019-05-09 07:57:03 -07:00
Simon Michael
72214a5747 reg: fix --value-at=transaction with -M (#329) 2019-05-06 08:07:16 -07:00
Simon Michael
ad00da244b reg: support --value-at with -H (#329) 2019-05-05 17:47:38 -07:00
Simon Michael
8d7eacd73f bal: support --value-at=p/t with multiperiod reports (#329) 2019-05-05 09:30:01 -07:00
Simon Michael
ec1b98434c reg: support --value-at=period with periodic reports (#329) 2019-05-04 12:22:00 -07:00
Simon Michael
ebf5ed93f2 valuation: more thorough --value-at; document status (#329, #999)
This feature turns out to be quite involved, as valuation interacts
with the many report variations. Various bugs/specs have been
fixed/clarified relating to register's running total, balance totals
etc. Eg register's total should now be the sum of the posting amount
values, not the values of the original sums. Current level of support
has been documented.

When valuing at transaction date, we once again do early valuation of
all posting amounts, to get more correct results. variants. This means
--value-at=t can be slower than other valuation modes when there are
many transactions and many prices. This could be revisited for
optimisation when things are more settled.
2019-05-03 12:24:02 -07:00
Simon Michael
696e3098c8 reg: support --value-at in register reports; cleanups, tests 2019-04-26 12:08:46 -07:00
Simon Michael
00975fb226 bal*: support --value-at in multicolumn balance reports 2019-04-26 12:08:31 -07:00
Simon Michael
65934958f9 rename --value-date -> --value-at; --value-at implies -V 2019-04-26 12:08:31 -07:00
Simon Michael
9adae02973 print: add --value-date general option; implement for print -V 2019-04-26 12:08:31 -07:00
Simon Michael
1d81316681 tests: convert market prices tests to format 3
[ci skip]
2019-04-24 08:43:02 -07:00
Simon Michael
9d3eb8c069 bal, reg, print: -V prefers non-future valuation dates again (#999) 2019-04-24 08:31:21 -07:00
Simon Michael
c23fc8b671 speed up -V/--value by converting reports, not the journal (#999)
Instead of converting all journal amounts to value early on, we now
convert just the report amounts to value, before rendering.

This was basically how it originally worked (for the balance command),
but now it's built in to the four basic reports used by print,
register, balance and their variants - Entries, Postings, Balance,
MultiBalance - each of which now has its own xxValue helper.

This should mostly fix -V's performance when there are many
transactions and prices (the price lookups could still be optimised),
and allow more flexibility for report-specific value calculations.

+------------------------------------------++-----------------+-------------------+--------------------------+
|                                          || hledger.999.pre | hledger.999.1sort | hledger.999.after-report |
+==========================================++=================+===================+==========================+
| -f examples/1000x1000x10.journal bal -V  ||            1.08 |              0.96 |                     0.76 |
| -f examples/2000x1000x10.journal bal -V  ||            1.65 |              1.05 |                     0.73 |
| -f examples/3000x1000x10.journal bal -V  ||            2.43 |              1.58 |                     0.84 |
| -f examples/4000x1000x10.journal bal -V  ||            4.39 |              1.96 |                     0.93 |
| -f examples/5000x1000x10.journal bal -V  ||            7.75 |              2.99 |                     1.07 |
| -f examples/6000x1000x10.journal bal -V  ||           11.21 |              3.72 |                     1.16 |
| -f examples/7000x1000x10.journal bal -V  ||           16.91 |              4.72 |                     1.19 |
| -f examples/8000x1000x10.journal bal -V  ||           27.10 |              9.83 |                     1.40 |
| -f examples/9000x1000x10.journal bal -V  ||           39.73 |             15.00 |                     1.51 |
| -f examples/10000x1000x10.journal bal -V ||           50.72 |             25.61 |                     2.15 |
+------------------------------------------++-----------------+-------------------+--------------------------+

There's one new limitation, not yet resolved: -V once again can pick a
valuation date in the future, if no report end date is specified and
the journal has future-dated transactions. We prefer to avoid that,
but reports currently are pure and don't have access to today's date.
2019-04-23 17:39:01 -07:00
Simon Michael
72c7861267 tests: note parse-errors.test fragility
[ci skip]
2019-04-20 09:25:09 -07:00
Simon Michael
ba850f3871 lib: more transaction balancing/assertions/assignments cleanup 2019-02-20 09:14:30 -08:00