Re: exporting to tabular format

2019-03-06 Thread Alan Schmitt

On 2019-03-07 00:07, Fergus Cameron  writes:

if you consider CSV a tabular format, it can.  you can post 
process it
from there ... although, one would need to understand the final 
result
to make that a sane suggestion since ledger can generally 
produce the

answers you need directly.


CSV would be fine. How do I do that?

My motivation is that my wife does not use ledger and she wants to 
use a

spreadsheet to look at our family expenses.

Best,

Alan

--

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


signature.asc
Description: PGP signature


Re: Income Statement" aka "Profit/Loss Statement" with unrealized gain due to changes in stock and currency exchange rate

2019-03-06 Thread John Wiegley
> Richard Lawrence  writes:

> I think John answered without seeing that you had already tried
> --unrealized, so let me try to help:

Indeed, thank you for catching that, Richard. :)

John

-- 

--- 
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: exporting to tabular format

2019-03-06 Thread Fergus Cameron
if you consider CSV a tabular format, it can.  you can post process it
from there ... although, one would need to understand the final result
to make that a sane suggestion since ledger can generally produce the
answers you need directly.  -- fergus

On 06/03/2019, Alan Schmitt  wrote:
> On 2019-03-06 13:04, Craig Earls  writes:
>
>> Not built in to ledger.
>
> Thanks. Are there scripting bridges to ledger that I could use for
> this?
>
> Alan
>
> --
>
> ---
> 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.
>

-- 

--- 
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: Income Statement" aka "Profit/Loss Statement" with unrealized gain due to changes in stock and currency exchange rate

2019-03-06 Thread Richard Lawrence
Hi Chary and all,

Here's a few more thoughts.

Chary Chary  writes:

> ok, thanks, it works indeed! Great!  It also works if I run report on 
> assets all together
>
> ledger -f ledger.txt bal Assets  -X EUR --now 2018-12-31 --unrealized
>
> But I am just thinking aloud here.
>
> Unrealized gains can only happen against assets, they cannot happen against 
> expenses or income. Correct?  So, to see all unrealized gains one just 
> needs to mention
>   
> bal Assets

Yes, that makes sense to me.

> However unrealized gains only make sense to show in "Income statement-like 
> report", hence in report, which contains Income and Expenses, but not 
> Assets, however I am forced to include Assets.

Here, I don't follow you.  (Maybe I don't understand what an "income
statement-like" report is?)

Conceptually, it seems to me that unrealized gains or losses have
nothing to do with income and expenses.  Income and expenses seem like
*realized* gains and losses, pretty much by definition, right?  If
you're in the context of asking about unrealized gains and losses,
you're not asking about income and expenses you actually had -- you're
asking about what income or expenses you *could potentially* have, if
you were to make a transaction that realizes them.

> Ledger does calculate unrealized gain correctly
>
> ledger -f ledger.txt bal Assets  -X EUR --now 2018-12-31 --unrealized
>  EUR1500  Assets:Checking
>  EUR-500  Equity:Unrealized Gains
> 
>  EUR1000
>
> But what is the meaning of these EUR1000 below the line?
> What Ledger is trying to tell me?
> Does it make any sense to add together Assets and unrealized gains? 
> I don't think these 1000 EUR have any sense

Well, as you recognize, the 1000 EUR you see here is just the sum of the
lines above.  Here's how I'd think about this report:

(potential assets) - (unrealized gains) = (actual assets)

>From that perspective, it makes sense.  The 1500 EUR on the first line
does not represent your actual current assets (according to your example
file, you don't *actually* have *any* euros!), but your potential
assets.  I guess the question is in what sense 1000 EUR represents your
"actual assets" here, but that has a pretty straightforward answer: it
represents the value in euros of the actual dollars in your account, at
the time they entered that account.

If you were to realize these gains by exchanging currencies, then you
could record the gains as Income.  I *think* this would be the right way
to do that:

2018-01-01  Opening Balance
Assets:Checking 1000.00 USD
Equity:Opening Balances

2018-07-10 My Currency Broker
; cash in on a sweet exchange rate!
Assets:Checking  1500.00 EUR
Assets:Checking -1000.00 USD {1 EUR} @ 1.5 EUR
Income:Realized Currency Gains

This uses ledger's notion of "lot price" to track the gains, following
the example with stocks in the manual.  Basically, the second
transaction says: I exchanged 1000 USD, which were valued at 1 EUR at
the time I acquired them, for 1500 EUR, at a rate of 1.5 EUR/USD.  The
unbalanced 500 EUR is realized as income, as you'll see if you run the
balance report.

Can someone with more experience confirm that this is the right way to
do it?  I'm also interested in this question.

-- 
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: exporting to tabular format

2019-03-06 Thread Alan Schmitt

On 2019-03-06 13:04, Craig Earls  writes:


Not built in to ledger.


Thanks. Are there scripting bridges to ledger that I could use for 
this?


Alan

--

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


signature.asc
Description: PGP signature


Re: Income Statement" aka "Profit/Loss Statement" with unrealized gain due to changes in stock and currency exchange rate

2019-03-06 Thread Chary Chary
Richard,

ok, thanks, it works indeed! Great!  It also works if I run report on 
assets all together

ledger -f ledger.txt bal Assets  -X EUR --now 2018-12-31 --unrealized


But I am just thinking aloud here.

Unrealized gains can only happen against assets, they cannot happen against 
expenses or income. Correct?  So, to see all unrealized gains one just 
needs to mention

  
bal Assets
 

However unrealized gains only make sense to show in "Income statement-like 
report", hence in report, which contains Income and Expenses, but not 
Assets, however I am forced to include Assets.

You can see on the below example


2018-01-01  Opening Balance
Assets:Checking 1000.00 USD
Equity:Opening Balances


P 2018-01-01 USD 1 EUR
P 2018-07-01 USD 1.5 EUR
==


So, at the end of the year I became 500 Euro richer due to exchange rate 
change.

Ledger does calculate unrealized gain correctly

ledger -f ledger.txt bal Assets  -X EUR --now 2018-12-31 --unrealized
 EUR1500  Assets:Checking
 EUR-500  Equity:Unrealized Gains

 EUR1000



But what is the meaning of these EUR1000 below the line?
What Ledger is trying to tell me?
Does it make any sense to add together Assets and unrealized gains? 
I don't think these 1000 EUR have any sense

I would expect some report, which would have EUR -500 below the line. 
Because I because richer by 500 EUR, which is supposed to be -500 in income 
statement in ledger's terms

Do you have any comments?


On Wednesday, March 6, 2019 at 1:29:43 PM UTC+1, Richard Lawrence wrote:
>
> Hi Chary, 
>
> Chary Chary > writes: 
>
> > But I can't find any report, which would show me why assets have 
> increased 
> > 2 times. Option --unrealized  does not have any effect in this case 
> > 
> > I would expect some report, which would say something like 
> > 
> > -1000 EUR Unrealized gain 
> > -1000 EURUnrealized gain due to EUR/USD changes 
> > 
> > So, how can it be done? 
>
> I think John answered without seeing that you had already tried 
> --unrealized, so let me try to help: 
>
> There is something sort of subtle going on with --unrealized.  If you 
> just run the balance report with --unrealized, but without specifying 
> any account like you did here: 
>
> > C:\_code\ledger>ledger -f ledger.txt balance -X EUR --now 2018-12-31 
> >  EUR2000  Assets:Checking 
> > EUR-2000  Equity:Opening Balances 
> >  
> >0 
>
> then you won't see any unrealized gains.  But if you specifically ask 
> for the balance of the Checking account in EUR, you'll see the 
> unrealized gains: 
>
> ledger -f ledger.txt bal Checking  -X EUR --now 2018-12-31 --unrealized 
>  EUR2000  Assets:Checking 
> EUR-1000  Equity:Unrealized Gains 
>  
>  EUR1000 
>
> I don't know exactly why this is, or even whether it's expected 
> (vs. being a bug), but maybe it makes some sense: when you're getting 
> the balance of all accounts together, including Equity, there are no 
> "unrealized" gains (the gains are "realized" in Equity, or at least 
> reflected in the balance of the Equity account, as you noticed).  But 
> when you are just getting the balance of Checking, and you're getting it 
> in a currency other than the amount actually inside that account, then 
> there are unrealized gains in that account, which ledger notices. 
>
> Hope that helps! 
>
> -- 
> 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: Income Statement" aka "Profit/Loss Statement" with unrealized gain due to changes in stock and currency exchange rate

2019-03-06 Thread Richard Lawrence
Hi Chary,

Chary Chary  writes:

> But I can't find any report, which would show me why assets have increased 
> 2 times. Option --unrealized  does not have any effect in this case
>
> I would expect some report, which would say something like 
>
> -1000 EUR Unrealized gain
> -1000 EURUnrealized gain due to EUR/USD changes
>
> So, how can it be done?

I think John answered without seeing that you had already tried
--unrealized, so let me try to help:

There is something sort of subtle going on with --unrealized.  If you
just run the balance report with --unrealized, but without specifying
any account like you did here:

> C:\_code\ledger>ledger -f ledger.txt balance -X EUR --now 2018-12-31
>  EUR2000  Assets:Checking
> EUR-2000  Equity:Opening Balances
> 
>0

then you won't see any unrealized gains.  But if you specifically ask
for the balance of the Checking account in EUR, you'll see the
unrealized gains:

ledger -f ledger.txt bal Checking  -X EUR --now 2018-12-31 --unrealized
 EUR2000  Assets:Checking
EUR-1000  Equity:Unrealized Gains

 EUR1000

I don't know exactly why this is, or even whether it's expected
(vs. being a bug), but maybe it makes some sense: when you're getting
the balance of all accounts together, including Equity, there are no
"unrealized" gains (the gains are "realized" in Equity, or at least
reflected in the balance of the Equity account, as you noticed).  But
when you are just getting the balance of Checking, and you're getting it
in a currency other than the amount actually inside that account, then
there are unrealized gains in that account, which ledger notices.

Hope that helps!

-- 
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: exporting to tabular format

2019-03-06 Thread Craig Earls
Not built in to ledger.

On Wed, Mar 6, 2019 at 00:19 Alan Schmitt 
wrote:

> Hello,
>
> Is there a way to export a ledger file to tabular format? Ideally,
> one
> would have one columns per account/asset and one line per
> transaction.
>
> Thanks,
>
> Alan
>
> --
>
> ---
> 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.
>
-- 
Craig, Corona De Tucson, AZ
[image: missile_flyout]
enderw88.wordpress.com

-- 

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