On Tue, Aug 27, 2019 at 3:16 AM <[email protected]> wrote:

> Hi,
>
> I've recently migrated to Beancount from Ledger. I'm really happy with it
> so far. :)
>
> One issue I've had is around transaction ordering across files. (To be
> clear, this is not at all a criticism of Beancount relative to Ledger; the
> plugin I'm trying to write wouldn't be possible in Ledger for a dozen
> reasons.)
>
> I mostly keep one file per "physical" account (e.g. one file for my
> Vanguard 401k). I also have a "budget" file that keeps transactions I use
> for envelope budgeting. Some of the budget transactions are logically
> linked with a debit to my checking account; in effect, money is divided up
> the instant it arrives.
>
> I'm trying to implement a plugin that ensures that my various budget
> accounts never drop below zero. However, if I'm reading the code correctly,
> transactions are sorted based on their date, type, and line number -- but
> not based on filename, and not based on anything that a plugin is supposed
> to be able to control.
>
> My questions are:
>
> 1. Is there a reason for this particular sorting order? It seems odd that
> line number would be used without filename -- it means that the order of
> two transactions could be changed by adding a lot of whitespace to one
> file, or by adding/removing metadata tags. (I tested this out, and
> confirmed that whitespace does have this effect.)
>

Hmm, I think it's an oversight. Sorting should be stable. I should add the
filename to the sort key.
https://bitbucket.org/blais/beancount/src/fe747dea5ce9eddfb4910b9edfdec1134f0a6c85/beancount/core/data.py#lines-581


2. More generally, are there any recommended patterns for imposing partial
> orders on transactions in different files? I know that I could put
> everything in one file, but I'd rather not; it's much easier for me to read
> and write (and make bulk changes to) my files if they're split up as they
> are now.
>

I think the absolute filename should disambiguate it enouhg.



>
> Note that addressing #1 (e.g. by changing the sort key to include filename
> before lineno) would not fully address my use case, since I want to
> interleave transactions between different files.
>

I don't understand this. They would be sorted by date, but within each
date, sorted by file, and then by line number.
(You're not supposed to rely on ordering within a day, Beancount does not
provide guarantees on ordering that way, just stable ordering.)





>
> Thanks!
> ~ aleksandra (pronouns: she/her)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/2c8b10d2-12e6-4170-829b-de5a0bb269c8%40googlegroups.com
> <https://groups.google.com/d/msgid/beancount/2c8b10d2-12e6-4170-829b-de5a0bb269c8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMwP2CEvMPhuZhbWZofNKCH_4ef%2BBSDM-auJ9TxcW3H5w%40mail.gmail.com.

Reply via email to