Re: Recording real balances in the presence of virtual transactions

2017-10-11 Thread John Lee
On Wed, 11 Oct 2017, at 17:40, Richard Lawrence wrote:
> Hi John,
> > then this balance command tells me I have made $100 out of thin 
> > air ($1105 total): 
> > 
> > ledger b Assets:CurrentAccount 
> > 
> > That's because in that final txn I'm actually setting not the 
> > summed-up total of everything in *or under* 
> > Assets:CurrentAccount, as appears in the balance output, but the 
> > amount that lives in that *exact* location (which you might 
> > write in a balance command as '^Assets:CurrentAccount$').  I'm 
> > not sure there's any way to fix that final txn to say that it's 
> > actually the *total* "descendant-or-self" value I want to set 
> > equal to $1005? 
> 
> Hmm, I see.  I'm surprised by this, but I don't use balance 
> assignments myself.  If you need balance assignments like this, I 
> guess subaccounts are not the way to go.  (Unless this is a bug?) 
> 
> Personally, I want every transaction recorded -- independently, so 
> I can check my record against my bank's.  Thus, I avoid what 
> you're trying to do here: automatic adjustments via balance 
> assertions.  But I realize that "don't do that" is not very 
> helpful advice. :)

For me my *next* (not immediate) goal will be just to import
transactions from my bank.  At that point I still won't independently
record the same transactions, but even that is a project that for me is
some time consuming steps away still (of course I hope later that I'll
get those transaction lining up with others in more detail than at
present).

However, even when I do import those txns, I think I'll *still* want to
write down the "ground truth" (total) figure from the bank explicitly in
the ledger regularly, not only transactional amounts (changes).

Perhaps the closest fit to my current "adjust regularly to match bank
balance" practice is to use value expression assertions like this:

2017-10-01 * Opening Balance
Assets:CurrentAccount   $1000
Equity:OpeningBalances

2017-10-02 * Savings
Assets:CurrentAccount:Savings   $100
Assets:CurrentAccount

2017-10-03 * Adjustment
Assets:CurrentAccount   $5
Equity:Adjustments

assert account("Assets:CurrentAccount").total == $1005


Which I took straight from some helpful people who hang out somewhere
called the "ledger-cli mailing list" ;-) who contributed to this:

https://github.com/ledger/ledger/wiki/Notes-from-the-Group#checks-and-assertions


> Can anyone else lend some insights?   

Yes please!

-- 

--- 
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.


Re: Recording real balances in the presence of virtual transactions

2017-10-11 Thread Richard Lawrence

Hi John,

John Lee  writes:

However, I guess I can't do this: 

2017-10-01 * Opening Balance 
Assets:CurrentAccount   $1000 Equity:OpeningBalances 

2017-10-02 * Savings 
Assets:CurrentAccount:Savings   $100 Assets:CurrentAccount 

Because then if I go on to do this: 

2017-10-03 * Adjustment 
Assets:CurrentAccount   = $1005 Equity:Adjustments 

then this balance command tells me I have made $100 out of thin 
air ($1105 total): 

ledger b Assets:CurrentAccount 

That's because in that final txn I'm actually setting not the 
summed-up total of everything in *or under* 
Assets:CurrentAccount, as appears in the balance output, but the 
amount that lives in that *exact* location (which you might 
write in a balance command as '^Assets:CurrentAccount$').  I'm 
not sure there's any way to fix that final txn to say that it's 
actually the *total* "descendant-or-self" value I want to set 
equal to $1005? 


Hmm, I see.  I'm surprised by this, but I don't use balance 
assignments myself.  If you need balance assignments like this, I 
guess subaccounts are not the way to go.  (Unless this is a bug?) 

Personally, I want every transaction recorded -- independently, so 
I can check my record against my bank's.  Thus, I avoid what 
you're trying to do here: automatic adjustments via balance 
assertions.  But I realize that "don't do that" is not very 
helpful advice. :)


Can anyone else lend some insights?   


--
Best,
Richard

--

--- 
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.


Re: Recording real balances in the presence of virtual transactions

2017-10-10 Thread John Lee
On Mon, 9 Oct 2017, at 02:14, Richard Lawrence wrote:
> Is there a reason you need to use a virtual transaction for this? 
> Why not just use a subaccount, like
> 
> 2017-10-01 * Opening Balance 
>  Assets:CurrentAccount:Savings  $100 Assets:CurrentAccount 
>  $900 Equity:OpeningBalances 
>  
> Then, the balance of Assets:CurrentAccount reflects what you are 
> currently tracking as the "real" balance, while the balance of 
> Assets:CurrentAccount:Savings reflects what you are currently 
> tracking as the "virtual" balance.  You don't have to mess with 
> virtual transactions (or the flags for dealing with them) at all.

Thanks -- honestly I'd entirely forgotten about subaccounts while
thinking about this!

Trying this out makes me realize I really didn't understand subaccounts,
and in fact I'm pretty sure I still don't understand how best to use
them for this purpose.

One thing against using subaccounts in this way is that you can't move
money from multiple real accounts into one virtual account (says
Funds:Savings).  It's true that for purposes of reports I guess I should
still be able pull those out by name as long as I name them
consistently, because of ledger's use of regexps.  However, I guess I
can't do this:

2017-10-01 * Opening Balance
Assets:CurrentAccount   $1000
Equity:OpeningBalances

2017-10-02 * Savings
Assets:CurrentAccount:Savings   $100
Assets:CurrentAccount

Because then if I go on to do this:

2017-10-03 * Adjustment
Assets:CurrentAccount   = $1005
Equity:Adjustments

then this balance command tells me I have made $100 out of thin air
($1105 total):

ledger b Assets:CurrentAccount

That's because in that final txn I'm actually setting not the summed-up
total of everything in *or under* Assets:CurrentAccount, as appears in
the balance output, but the amount that lives in that *exact* location
(which you might write in a balance command as
'^Assets:CurrentAccount$').  I'm not sure there's any way to fix that
final txn to say that it's actually the *total* "descendant-or-self"
value I want to set equal to $1005?

Exactly the same problem crops up if I try splitting out, starting from
the start of the journal, the non-savings amount into an
Assets:CurrentAccount:Unallocated (only this time I end up with an extra
$1000 out of thin air -- so obviously this is the better method :-).

If I instead try creating a new Antisavings subaccount just when I
balance the savings:

2017-10-01 * Opening Balance
Assets:CurrentAccount   $1000
Equity:OpeningBalances

2017-10-02 * Savings
Assets:CurrentAccount:Savings   $100
Assets:CurrentAccount:Antisavings

2017-10-03 * Adjustment
Assets:CurrentAccount   = $1005
Equity:Adjustments

Then balance commands like these print what I expected:

ledger b Assets:CurrentAccount

ledger b Assets:CurrentAccount and not Assets:CurrentAccount:Savings

But this seems like a horrible abuse: I'm still not declaring what I
want to declare, which is that I have $1005 dollars total in that real
current account.  Plus I then have a mysterious -$100 in AntiSavings and
a feeling that I don't know what I'm doing and probably shouldn't be
allowed to use ledger.

Can anybody unconfuse me?

-- 

--- 
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.


Recording real balances in the presence of virtual transactions

2017-10-08 Thread John Lee
I love ledger and I'm really grateful and happy I found it :-)

I've been using virtual transactions for a few months but I'm not yet
happy with the way I'm doing it.  I have transactions like this:

2017-10-01 * Opening Balance
Assets:CurrentAccount   $1000
Equity:OpeningBalances

2017-10-02 * Savings
[Funds:Saving]$100
[Assets:CurrentAccount]$-100

When I find out my current account balance, I have something like this
(I'm still not yet importing transactions from my bank, so I'm just
adding adjustments periodically):

2017-10-03 * Balance
Assets:CurrentAccount= $ 900  ; really $1000
Equity:Adjustments

My problem is that I'd like to record the real balance of
Assets:CurrentAccount ($1000) somewhere (aside from the comment), rather
than only the virtual balance ($900).  Partly because that's "ground
truth" that I'd like to directly record, and partly because otherwise
I'm currently doing the calculation $1000 - $100 myself rather than
letting ledger do that for me, which seems a bit error prone and more
work than needed.

Is there a means of doing that?

Am I doing it all wrong and there's a better way to achieve my goal
using different features?

-- 

--- 
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.