Commit Graph

62 Commits

Author SHA1 Message Date
Simon Michael
102b76c17f lib: textification: commodity symbols
hledger -f data/100x100x10.journal stats
<<ghc: 39288536 bytes, 77 GCs, 196608/269560 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.001 elapsed), 0.016 MUT (0.028 elapsed), 0.009 GC (0.012 elapsed) :ghc>>
<<ghc: 39290808 bytes, 77 GCs, 196608/269560 avg/max bytes residency (3 samples), 2M in use, 0.000 INIT (0.003 elapsed), 0.015 MUT (0.021 elapsed), 0.009 GC (0.011 elapsed) :ghc>>

hledger -f data/1000x100x10.journal stats
<<ghc: 314268960 bytes, 612 GCs, 2143219/6826152 avg/max bytes residency (7 samples), 16M in use, 0.000 INIT (0.009 elapsed), 0.135 MUT (0.151 elapsed), 0.065 GC (0.178 elapsed) :ghc>>
<<ghc: 314254512 bytes, 612 GCs, 2072377/6628024 avg/max bytes residency (7 samples), 16M in use, 0.000 INIT (0.000 elapsed), 0.130 MUT (0.134 elapsed), 0.064 GC (0.075 elapsed) :ghc>>

hledger -f data/10000x100x10.journal stats
<<ghc: 3070016592 bytes, 5965 GCs, 13138220/64266016 avg/max bytes residency (10 samples), 128M in use, 0.000 INIT (0.000 elapsed), 1.272 MUT (1.322 elapsed), 0.527 GC (0.595 elapsed) :ghc>>
<<ghc: 3069989896 bytes, 5973 GCs, 12687877/62848920 avg/max bytes residency (10 samples), 124M in use, 0.000 INIT (0.002 elapsed), 1.295 MUT (1.324 elapsed), 0.511 GC (0.570 elapsed) :ghc>>

hledger -f data/100000x100x10.journal stats
<<ghc: 30753448072 bytes, 59763 GCs, 121502982/673169248 avg/max bytes residency (14 samples), 1640M in use, 0.000 INIT (0.007 elapsed), 12.421 MUT (12.672 elapsed), 6.240 GC (7.812 elapsed) :ghc>>
<<ghc: 30753350528 bytes, 59811 GCs, 117616668/666703600 avg/max bytes residency (14 samples), 1588M in use, 0.001 INIT (0.011 elapsed), 13.209 MUT (13.683 elapsed), 6.137 GC (7.117 elapsed) :ghc>>
2016-05-24 19:00:57 -07:00
Simon Michael
ea383d88d6 lib: drop "double" build flag 2016-05-18 20:32:58 -07:00
Simon Michael
207922a023 lib: Commodity now has a CommoditySymbol and style 2016-05-08 08:07:27 -07:00
Simon Michael
11fee9fbe8 ui: txn: show multi-commodity amounts on one line
In the transaction screen, show multi-commodity posting amounts on one
line, consistent with the rest of hledger-ui.
2015-10-29 18:10:06 -07:00
Simon Michael
821f1b7120 lib: fix tests for zero amount style (#230, #276) 2015-09-02 16:38:45 -07:00
Simon Michael
b8d75b7728 balance, etc: fix amount style loss (fixes #230, #276)
hledger-lib-0.24's "track the commodity of zero amounts when
possible (useful eg for hledger-web's multi-commodity charts)" preserved
the commodity when normalising a zero mixed amount, but not the amount
style. This showed up as occasionally incorrect amount style (commodity
symbol placement, decimal point character, etc.) in balance reports with
certain journals, like this:

  $ hledger bal
              €3000.00  a     <------ not using the canonical € style
              4000,58€    1
             -1000,58€    D
             -3000,00€  e
  --------------------
                     0

I thought this would require a big rewrite of amount arithmetic, but it
seems that just being a little more careful is enough. When normalising
a mixed amount containing multiple zeros in the same commodity, we now
preserve the last zero with its amount style, instead of replacing them
all with a new one.
2015-09-02 16:21:56 -07:00
Simon Michael
94094252be rename historical prices to market prices
Simpler and clearer. We now have "transaction prices" (recorded as part
of transaction amounts) and "market prices" (recorded with P
directives). Both are matters of historical record, also this avoids
confusion with the balance command's "historical balances".
2015-08-09 16:20:02 -07:00
Simon Michael
5978a19b15 finish refactoring balanceTransaction 2015-07-02 16:59:43 -07:00
Simon Michael
592ae9a28e timelog: show hours with 2 decimal places, not 1 2015-02-27 08:37:16 -08:00
Simon Michael
099a1de3b6 clarify built-in commodities rounding 2015-02-27 08:37:16 -08:00
Simon Michael
ba0623165f balance: row totals/averages in multicolumn mode 2014-12-27 15:24:45 -08:00
Simon Michael
3b70362525 switch to Decimal for representing quantities (closes #118)
hledger has represented quantities with floating point (Double) until
now.  While this has been working fine in practice, the time has come to
upgrade our number representation to something more principled: Decimal,
for now. As a bonus, this brings a ~30% speed boost to most reports.

We'll keep the old representation(s) around for a while, selectable via
hledger-lib cabal flag, for research/testing/benchmarking purposes. To
build with the old Double representation: cabal install -fdouble
hledger-lib hledger hledger-web
2014-10-18 12:33:31 -07:00
Simon Michael
e888be0bf4 clarify similarAmountsOp doc 2014-10-18 10:45:17 -07:00
gwern
d1618aaca8 strip trailing whitespace from all Haskell files 2014-10-14 18:48:24 -07:00
Simon Michael
40ab1e17f6 amounts cleanups, and support zeros with commodity 2014-07-28 18:45:13 -07:00
Simon Michael
f2d9c6e9c1 web: more register chart improvements
- show a background color for future and less-than-zero regions
- show points for transactions, not all line corners
- hovering over point shows balance, date, posted amount and transaction
- clicking a point scrolls towards that date
2014-07-18 16:45:46 -07:00
Simon Michael
16f8b78305 balance: show multi-commodity amts on one line (fixes #186)
To avoid totally breaking the layout of multicolumn balance reports when
there are multi-commodity balances, these are now rendered on a single
line, comma separated. Simple balance reports still use the old vertical
format for now.
2014-07-03 07:45:55 -07:00
Simon Michael
c31710d942 look harder for decimal point & digit groups (fixes #196)
Amount display styles have been reworked a bit; they are now calculated
after journal parsing, not during it. This allows the fix for #196:
we now search through the amounts until a decimal point is detected,
instead of just looking at the first one; likewise for digit groups.
Digit groups are now implemented with a better type.

Digit group size detection has been improved a little:
1000,000 now gives group sizes [3,4,4,...], not [3,3,...], and
10,000 gives groups sizes [3,3,...] not [3,2,2,..].
(To get [3,2,2,...] you'd use eg 00,00,000.)

There are still some old (or new ?) issues; I don't think we handle
inconsistent decimal points & digit groups too well. But for now all
tests pass.
2014-07-02 23:26:16 -07:00
Simon Michael
8ae303f685 assert only a single commodity, like Ledger (fixes #195)
This change means you can make assertions on a multi-commodity account
balance (asserting one commodity at a time). On the flip side, you can
no longer assert the complete balance of an account (new unexpected
commodities will not be detected.) We might restore that ability later,
using the == syntax.
2014-07-02 07:35:06 -07:00
Simon Michael
21575ed47b more verbose Amount debug output at level 6+ 2014-04-03 18:49:56 -07:00
Simon Michael
874c467789 briefer mixed amount debug output below level 3 2014-04-03 18:49:56 -07:00
Simon Michael
13641eab66 debug level sets amount/journal show verbosity
Amounts and journal values are often rendered too verbosely in debug
output, obscuring what's important. Here we try adjusting the level
of detail in the Show instance based on the global debug level.
Needs more work.
2013-12-06 13:51:19 -08:00
Simon Michael
c2fa4b3c21 parsing: make balance assertions more robust with different precisions (#119)
Also note another issue.
2013-06-01 13:39:00 -07:00
Simon Michael
79f0e98186 tools: fix haddock generation (web excluded) 2012-11-19 23:36:36 +00:00
Simon Michael
1c6a7d8a6f rename the commodityless amount constructor to num 2012-11-20 02:22:20 +00:00
Simon Michael
45d4a38cc7 refactor: setAmountPrecision -> withPrecision 2012-11-19 23:24:04 +00:00
Simon Michael
64180b18ef refactor: clarify that price amounts have only a single commodity 2012-11-19 23:17:55 +00:00
Simon Michael
8c06553e3b refactor: make amount price a non-maybe, reducing noise 2012-11-19 22:39:08 +00:00
Simon Michael
4567e91409 refactor: move amount display settings out of commodity, simplify amount construction 2012-11-19 21:20:10 +00:00
Simon Michael
cbc7661703 87: fix an arithmetic and transaction balancing bug with multiple total-priced amounts 2012-11-12 16:31:43 +00:00
Simon Michael
5b9c5459be web: make hledger[-lib] compatible with all of yesod's language extensions
Useful when building all of hledger-web at once.
2012-11-14 17:25:02 +00:00
Simon Michael
a03fd1d89f fix haddock complaints 2012-05-27 18:20:18 +00:00
Simon Michael
3ee6a351f3 big query/tests/show refactoring
- use new query system for command line too, filterspec is no more
- move unit tests near the code they test, run them in bottom up order, add more
- more precise Show instances, used for debugging not ui
2012-05-27 18:14:20 +00:00
Simon Michael
1bc4d4b395 refactor: clarify mixed amount normalising a bit 2012-01-01 00:39:13 +00:00
Simon Michael
1de9cc1d80 fix a regression balancing a transaction containing different prices
And try to clarify amount arithmetic a bit more. More to come I expect.
2011-09-03 21:27:37 +00:00
Simon Michael
68f13e18af amount haddock updates 2011-08-31 17:22:53 +00:00
Simon Michael
676845b269 trim even more fat from amounts 2011-08-31 17:44:20 +00:00
Simon Michael
06e224dc4a haddock updates 2011-08-31 17:44:31 +00:00
Simon Michael
b32ee2fa04 fix/rename convertMixedAmountToCommodity, yay release tests 2011-09-02 00:42:41 +00:00
Simon Michael
10fd7ebc42 simplify amounts code, make tests pass 2011-08-31 16:54:10 +00:00
Simon Michael
1273f02a9a more balance/amount clarifications and a test 2011-08-30 11:37:36 +00:00
Simon Michael
d4545966b5 amount code, test cleanups 2011-08-31 00:40:21 +00:00
Simon Michael
379184fd31 Amount haddock & code cleanups 2011-08-30 13:16:30 +00:00
Trygve Laugstol
28dbb8864f Adding basic ledger FORMAT parser. 2011-06-20 21:33:26 +00:00
Simon Michael
5084280879 imports, api cleanup 2011-05-28 04:11:44 +00:00
Simon Michael
505d677461 docs: haddock fixes 2011-04-18 06:36:00 +00:00
Simon Michael
b2f439eb11 try showing integral "maxprecision" amounts without the .0 (except in add's defaults, where it helps) 2011-01-20 00:17:32 +00:00
Simon Michael
bfe935e18c fix a sign bug with negative total-priced (@@) amounts 2011-04-22 13:40:55 +00:00
Simon Michael
091ec4e51f clarify that amount arithmetic does not handle multiple commodities 2011-04-22 13:44:08 +00:00
Simon Michael
137cc8292e amount cleanups 2011-01-19 23:27:11 +00:00