Update: It seems to work better if I associate the commodity with a multiplier. I also needed to add some rounding. The following seems to do the trick:
= /Liabilities:Credit Card/ Income:Credit Card Rewards 0.01 Trading:Credit Card Rewards -0.01 Trading:Credit Card Rewards (-1 Points * roundto(-1 * amount, 0)) Assets:Credit Card Rewards (1 Points * roundto(-1 * amount, 0)) For some reason the roundto() wasn't working as I expected unless I negated the amount inside the function. Adam On Saturday, October 28, 2017 at 6:41:24 PM UTC-7, Adam Sonnanstine wrote: > > Hello, I am new to ledger and have run into a snag when attempting to set > up some automated transactions to track my credit card rewards points. > Let's say that my credit card gives me one point for each dollar I spend > on the card, and each point is generally worth $0.01. It seems like I > should be able to write something like: > > = /Liabilities:Credit Card/ > Income:Credit Card Rewards 0.01 > Trading:Credit Card Rewards -0.01 > Trading:Credit Card Rewards (-1 * amount) Points > Assets:Credit Card Rewards (1 * amount) Points > > but I get an error: > > While parsing posting: > Trading:Credit Card Rewards (-1 * amount) Points > ^^^^^^^^^^^^^^^^^^^^ > Error: Unexpected char 'P' (Note: inline math requires parentheses) > > Some experimentation suggests that I cannot combine inline math and a > commodity that differs from the matched posting. Does that seem correct? > Is it possible to accomplish what I'm trying to do here? Any suggestions > on how I might accomplish this differently? Thanks, > > Adam > -- --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
