Best approach for folder structure | Generic transaction question

124 views
Skip to first unread message

Logic-gate

unread,
Jun 16, 2023, 6:38:04 AM6/16/23
to Beancount
Hey,

I am on the verge of creating a front-end app for SailfishOS. I am trying to figure out the best approach for folders.

My core folder structure is as follows(See Structure Class)

Diagram1.png 

An imperative note here is that it relies on the separation of transaction folders as per the user's definition. This could be based accounts, sub-accounts, monthly, yearly...the lots.

Example:
  • ledger.beancount
  • ledgers
    • 2023
      • income.beancount
      • expenses.beancount
      • etc...
Or

  • ledger.beancount
  • ledgers
    • Income
      • 2023
        • ledger.beancount

The structure of the documents folder will mirror 'ledgers' 

The idea is to regex the entry type and commit the entry to the appropriate file; for example if the entry type is `open` or `pad`, these will go to the main ledger(defined as `ledger.beancount` in the example above) and so on.

Is this folder structure method considered acceptable?
If not, is there a best-practices structure that I can use?    

As for my generic transaction question, following the documentation; I couldn't find how to exactly to register a `buy` trade and match it to a `sell` order. Previously I had to implement this ugly function(https://github.com/Logic-gate/cryptodash/blob/main/operations/beancount.py#L153)  and I seem to have written a note to the effect of "there is currently no programmatic way to match the sell transaction with the initial buy trade".

Is this still true? if not, mind sharing a snippet of how it's done as per the documentation here(https://beancount.github.io/docs/api_reference/beancount.core.html).


And thank you very much for beancount, it has saved me a lot of money and headache.


Cheers,

Martin Blais

unread,
Jun 17, 2023, 12:05:08 AM6/17/23
to bean...@googlegroups.com
About the ledgers: It doesn't make sense to segregate transaction by account type.
Use a single large file, it what I'd recommend.

About matching: I'm not too sure what you mean by match, the way it works is that as you accrue postings to an inventory it'll attempt to pair off with existing postings with the same Cost values. If you want to be really specific you can put labels on each posting and be explicit about which of those lots you want to reduce in a later transaction.




--
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 beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/03745325-f0d5-45a0-a0bf-17e2836ef73fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages