I couldn't find a good way to do this with automated transactions or with Ledger's existing support for Python, so I wrote a script that creates the necessary virtual postings and passes the result to Ledger:
https://github.com/alapala/ledger-partnership-tag If anyone has a better way to do this, please let me know! Best regards, APL On Monday, January 16, 2017 at 1:01:32 PM UTC-5, bcexelbi wrote: > > On Mon, Jan 16, 2017, at 05:59 PM, APL wrote: > > Thanks guys. > > The trouble with automated transactions is that there doesn't seem to be a > way to parameterize the generated transaction amounts. For example, you > might wish to split an expense 60/40, 36/64, or by some other arbitrary > partition. Alternatively, you might want to specify a dollar-split (e.g., > APL pays $21,000 and NPL $9,500 for that $30,500 car that they just bought). > > > I wonder if you couldn't use the multipliers with expressions ( > http://ledger-cli.org/3.0/doc/ledger3.html#Amount-multipliers) to define > some accounts with splits as needed. I wonder if you couldn't include a > tag to say that an account should get the automatic treatment and in those > cases do the split manually, like with your car. > > regards, > > bex > > > APL > > > On Sunday, January 15, 2017 at 4:23:30 PM UTC-5, Peter Keen wrote: > > I do something like this to run my sinking funds and have documented it > here: > > https://www.petekeen.net/program-your-finances-envelope-budgeting > > Basically you can use automated transactions to get close to what you > want, although I'm not sure how you use the value of a tag like that to > cook an automated transaction. Others here may be able to help on that > front. > > On Sat, Jan 14, 2017 at 12:26 PM, APL <alan.pa...@gmail.com> wrote: > > I'd like to use Ledger to track the finances of a two-person household, > recording transactions to both aggregate household accounts and individual > ownership stakes. > > Two questions: > > - Is there a preferred way to do this? > - Supposing I do this using tags to identify "shadow accounts," how > would you recommend processing shadow account tags? > > By "shadow account," I mean a pair of non-real accounts that is > established for each real account, corresponding to the ownership stakes of > the two people in the household. The shadow accounts have the property that > the sum of the postings to each pair of shadow accounts equals the total > posting to the corresponding real account. > > To illustrate, suppose a household that consists of two people: APL and > NPL. > > - APL works at the local metropolitan transportation authority > - NPL works at a glass factory > - APL and NPL share an apartment, a checking account, and a credit card > > We want to track APL & NPL's total household earnings and expenses as well > as their individual ownership stakes in their assets and liabilities. We > can do this with shadow accounts implemented with virtual postings. Here's > an example journal file for APL & NPL: > > > 2017-01-06 (#1) MTA > Assets:Cash:Checking $1000.00 > Income:Salary > [APL:Assets:Cash:Checking] $1000.00 > [APL:Income:Salary] $-1000.00 > [NPL:Assets:Cash:Checking] $0.00 > [NPL:Income:Salary] $0.00 > > 2017-01-10 (#2) Landlord > Expenses:Rent $960.00 > Assets:Cash:Checking > [APL:Expenses:Rent] $480.00 > [APL:Assets:Cash:Checking] $-480.00 > [NPL:Expenses:Rent] $480.00 > [NPL:Assets:Cash:Checking] $-480.00 > > 2017-01-13 (#3) Glass Factory > Assets:Cash:Checking $1200.00 > Income:Salary > [APL:Assets:Cash:Checking] $0.00 > [APL:Income:Salary] $0.00 > [NPL:Assets:Cash:Checking] $1200.00 > [NPL:Income:Salary] $-1200.00 > > 2017-01-15 (#4) Pacific Gas & Electric > Expenses:Utilities $85.00 > Liabilities:Credit:Visa > [APL:Expenses:Utilities] $42.50 > [APL:Liabilities:Credit:Visa] $-42.50 > [NPL:Expenses:Utilities] $42.50 > [NPL:Liabilities:Credit:Visa] $-42.50 > > > > To clarify each transaction: > > 1. APL earns $1,000 from the MTA and deposits his earnings to the > couple's checking account > 2. APL & NPL contribute equally to their rent payment of $960 > 3. NPL earns $1,200 from the glass factory and deposits her earnings > to the couple's checking account > 4. APL & NPL pay their gas bill of $85 with their credit card, each > recording equal contributions > > The journal gives us APL & NPL's household balance sheet: > > > $ ledger bal --real > > $1240.00 Assets:Cash:Checking > > $1045.00 Expenses > > $960.00 Rent > > $85.00 Utilities > > $-2200.00 Income:Salary > > $-85.00 Liabilities:Credit:Visa > > -------------------- > > > 0 > > > Using shadow accounts allows us to view APL's and NPL's individual > ownership stakes in each of their accounts. > > > $ ledger bal ^APL > > 0 APL > > $520.00 Assets:Cash:Checking > > $522.50 Expenses > > $480.00 Rent > > $42.50 Utilities > > $-1000.00 Income:Salary > > $-42.50 Liabilities:Credit:Visa > > -------------------- > > 0 > > $ ledger bal NPL > > 0 NPL > > $720.00 Assets:Cash:Checking > > $522.50 Expenses > > $480.00 Rent > > $42.50 Utilities > > $-1200.00 Income:Salary > > $-42.50 Liabilities:Credit:Visa > > -------------------- > > 0 > > > Note that adding APL and NPL's balance sheets yields the household balance > sheet. > > The reason for the second of my original two questions (i.e., how do you > process shadow account tags?) is that recording shadow accounts with > virtual postings in every transaction is a tedious process, and I'd like > instead to use tag-value pairs to record shadow account information. > Instead of recording the journal entries listed above, I'd like to record > the following, where the value of the *Shadow* tag holds the ownership > weights necessary to derive the shadow account postings: > > > 2017-01-06 (#1) MTA > ; Shadow: APL 100/NPL 0 > Assets:Cash:Checking $1000.00 > Income:Salary > > 2017-01-10 (#2) Landlord > ; Shadow: APL 50/NPL 50 > Expenses:Rent $960.00 > Assets:Cash:Checking > > 2017-01-13 (#3) Glass Factory > ; Shadow: APL 0/NPL 100 > Assets:Cash:Checking $1200.00 > Income:Salary > > 2017-01-15 (#4) Pacific Gas & Electric > ; Shadow: APL 50/NPL 50 > Expenses:Utilities $85.00 > Liabilities:Credit:Visa > > > > The result is an informationally equivalent journal file with two postings > per transaction instead of six. > > Elaborating on my original questions: > > - Is there a better (and more widely accepted) way to do this? > - If not, how would you recommend processing the Shadow tags? > > Being new to Ledger, my first thought to processing Shadow tags is to > write a Python script that generates a "cooked" journal file that includes > the shadow account virtual postings based on the Shadow tag-value pairs; > Ledger could then read the cooked journal instead. Alternatively, maybe > there's some facility in Ledger itself that could achieve this. > > > APL > > > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "Ledger" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ledger-cli+...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "Ledger" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to ledger-cli+...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > > -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.