Conservancy Kallithea NPO-Accounting/oxrlib feedhttps://k.sfconservancy.org/NPO-Accounting/oxrlib2020-05-20T20:02:47Zhistorical: Move normalize_rate and _pretty_rate to base Formatter.
This reduces the number of method overrides to help readability,
and gets rid of the ann...2020-05-20T20:02:47Z2020-05-20T20:02:47ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-20://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/5a73d3d8f8d448be18de28f4cbcbca0d98f6925fBrett Smith committed on 2020-05-20 20:02:47<br/>branch: master<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/5a73d3d8f8d448be18de28f4cbcbca0d98f6925f">5a73d3d8</a><pre>historical: Move normalize_rate and _pretty_rate to base Formatter.<br/><br/>This reduces the number of method overrides to help readability,<br/>and gets rid of the annoying format_rate/pretty_rate distinction.
modified oxrlib/commands/historical.py (27 lines added, 33 lines removed)</pre>tests: Make consistent rate test a little more robust.
2020-05-20T19:35:27Z2020-05-20T19:35:27ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-20://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/77393ee80fde12e5b5692b87fb9152eb06036911Brett Smith committed on 2020-05-20 19:35:27<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/77393ee80fde12e5b5692b87fb9152eb06036911">77393ee8</a><pre>tests: Make consistent rate test a little more robust.
modified tests/test_historical.py (3 lines added, 3 lines removed)</pre>historical: Fix the rate ordering with two dates.
Darnit, I wrote the tests first, and I wrote them right, and then I
mixed up the ordering in the code, and...2020-05-20T19:21:13Z2020-05-20T19:21:13ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-20://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/c9382a26044a0109f3c384ffd0398ecc8f01a688Brett Smith committed on 2020-05-20 19:21:13<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/c9382a26044a0109f3c384ffd0398ecc8f01a688">c9382a26</a><pre>historical: Fix the rate ordering with two dates.<br/><br/>Darnit, I wrote the tests first, and I wrote them right, and then I<br/>mixed up the ordering in the code, and somehow I convinced myself<br/>the code was the right and the tests were wrong. But no, I had the<br/>tests right, this is really what we want. This gets the output to<br/>follow the examples from our bookkeeping documentation.
modified oxrlib/commands/historical.py (4 lines added, 2 lines removed)
modified setup.py (1 lines added, 1 lines removed)
modified tests/test_historical.py (7 lines added, 8 lines removed)</pre>historical: Always format rates with the same precision.
When we format a rate as a price, we don't know how much precision
is "enough" to do the conversion...2020-05-19T19:56:19Z2020-05-19T19:56:19ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-19://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/ae3e4617d31e98777f6872ee3b8caaf2fe90dc62Brett Smith committed on 2020-05-19 19:56:19<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/ae3e4617d31e98777f6872ee3b8caaf2fe90dc62">ae3e4617</a><pre>historical: Always format rates with the same precision.<br/><br/>When we format a rate as a price, we don't know how much precision<br/>is "enough" to do the conversion, because we don't know what's<br/>being converted to. As a result, we may (=will almost certainly)<br/>end up formatting the rate with different precision on the cost<br/>date vs. the price date, and that causes Beancount/Ledger to fail<br/>to make the connection between them.<br/><br/>Using a constant of 6 is enough to make the current test for<br/>"enough" precision pass, so just do that for now. This might need<br/>further refinement in the future.
modified oxrlib/commands/historical.py (10 lines added, 26 lines removed)
modified setup.py (1 lines added, 1 lines removed)
modified tests/test_historical.py (21 lines added, 0 lines removed)</pre>historical: Swap Ledger and Beancount formatters in the class hierarchy.
This makes sense for a couple of reasons:
* The Beancount formatter has "less feat...2020-05-19T19:27:04Z2020-05-19T19:27:04ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-19://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/8dede9d1398cddf7a2117cdb3c38ba44000372bdBrett Smith committed on 2020-05-19 19:27:04<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/8dede9d1398cddf7a2117cdb3c38ba44000372bd">8dede9d1</a><pre>historical: Swap Ledger and Beancount formatters in the class hierarchy.<br/><br/>This makes sense for a couple of reasons:<br/><br/>* The Beancount formatter has "less features" than the Ledger formatter, so<br/> this is a more "logical" organization of the hierarchy anyway. Note how<br/> this eliminates the need for the BeancountFormatter.__init__ override to<br/> turn off Ledger features.<br/><br/>* Any future work will probably be focused on the Beancount formatter, so<br/> this reduces the amount of code you have to understand and hold in your<br/> head to do that.
modified oxrlib/commands/historical.py (11 lines added, 23 lines removed)</pre>historical: Beancount can handle commas in amounts.
And having it looks nicer, is more consistent with our historical
books, is less code for me, and is no ...2020-05-19T19:22:00Z2020-05-19T19:22:00ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-19://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/c3fd55ec15b796db29550bb2fd4ccfe8100c2dcfBrett Smith committed on 2020-05-19 19:22:00<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/c3fd55ec15b796db29550bb2fd4ccfe8100c2dcf">c3fd55ec</a><pre>historical: Beancount can handle commas in amounts.<br/><br/>And having it looks nicer, is more consistent with our historical<br/>books, is less code for me, and is no more trouble for the user.
modified oxrlib/commands/historical.py (2 lines added, 2 lines removed)
modified tests/test_historical.py (1 lines added, 2 lines removed)</pre>gitignore: Modernize.
2020-05-17T18:12:15Z2020-05-17T18:12:15ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-17://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/e158eae7d9aee6cea70752a589f45aacc6484684Brett Smith committed on 2020-05-17 18:12:15<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/e158eae7d9aee6cea70752a589f45aacc6484684">e158eae7</a><pre>gitignore: Modernize.
modified .gitignore (5 lines added, 1 lines removed)</pre>setup: Version 2.0 for all the recent changes.
2020-05-17T18:10:17Z2020-05-17T18:10:17ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-17://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/30e9f1c1e88a4bbc8ddb783fcf096f7b5d63ab68Brett Smith committed on 2020-05-17 18:10:17<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/30e9f1c1e88a4bbc8ddb783fcf096f7b5d63ab68">30e9f1c1</a><pre>setup: Version 2.0 for all the recent changes.
modified setup.py (1 lines added, 1 lines removed)</pre>oxrlib_example: Update for Beancount.
2020-05-17T18:08:59Z2020-05-17T18:08:59ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-17://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/5573caf7ee0ef0a208277c74fa92ebed51495074Brett Smith committed on 2020-05-17 18:08:59<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/5573caf7ee0ef0a208277c74fa92ebed51495074">5573caf7</a><pre>oxrlib_example: Update for Beancount.
modified oxrlib_example.ini (3 lines added, 3 lines removed)</pre>historical: Add Beancount output format.
2020-05-17T18:05:49Z2020-05-17T18:05:49ZBrett Smithbrettcsmith@brettcsmith.orgtag:https:,2020-05-17://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/3a3afb79786b0439820ac5245d7fe28368d53f0cBrett Smith committed on 2020-05-17 18:05:49<br/>changeset: <a href="https://k.sfconservancy.org/NPO-Accounting/oxrlib/changeset/3a3afb79786b0439820ac5245d7fe28368d53f0c">3a3afb79</a><pre>historical: Add Beancount output format.
modified oxrlib/commands/historical.py (23 lines added, 0 lines removed)
modified oxrlib/config.py (3 lines added, 2 lines removed)
modified tests/test_historical.py (29 lines added, 10 lines removed)</pre>