I asked John about the difference between -B and -I on IRC.  I'm
moving the conversation to the list because John went to dinner and
I'm about to go to sleep and because other folks might find this
interesting as well.

22:51 < tbm> johnw: what's the difference between -B and -I?  You say -I "this 
is the same as the cost if none specified"  what does "none specified" refer to?
22:51 < johnw> if you say: 10 AAPL {$10} @ $20
22:51 < johnw> -B reports $200
22:51 < johnw> -I reports $100
22:51 < johnw> the corresponding value expression values are:
22:51 < johnw> amount = 10 AAPL
22:51 < johnw> price = $10
22:51 < johnw> cost = $20
22:52 < johnw> aka, $10 was the price of AAPL on that day, but $20 is what it 
cost you to get them
22:53 < tbm> isn't it the other way around? $20 was the price on that day, $10 
what it cost to get them

I thought some more about what John said and my question and it seems
that my last comment was wrong.  As John said, $10 is the price of
AAPL on that day and for some reason you spent $20 to buy something
that has a price of $10.  So the price is $10 but your cost is $20.
(I'm not sure if there is a valid use scenario for this; it obviously
makes sense when selling things, though).

There are two things I don't understand:

1) I put John's example into a ledger file as follows:

2012-03-17 * Test
   A      10 AAPL {$10} @ $20
   B                    -$200

but this doesn't balance.  ledger expects the following:

2012-03-17 * Test
   A      10 AAPL {$10} @ $20
   B                    -$100

I don't understand this.  If I'm buying 10 AAPL at $20 each, surely I
should spend $200.

I can fix this up by accounting for the capital loss made when buying
something worth $100 for $200:

2012-03-17 * Test
   A         10 AAPL {$10} @ $20
   B                       -$200
   Expenses:Capital loss    $100

But still... that seems strange to me.  Normally you make a capital gain
or less when selling something.  If you buy something worth $100 for
$200 then imho you don't incur a capital loss immediately... only when
you actually sell it for $200.  But maybe I'm wrong on this.  I'd have
to check what the various accounting standards say.

In any case, is there actually a use scenario for this?

2) Anyway, the more important question is this:

John gave the example of 10 AAPL {$10} @ $20 and said that $10 is the
price and $20 the cost.

But is this always true?  Is the amount in {} always the price and the
amount after @ the cost?  This seems exactly opposite to what I would
expect when selling something.

Let's say I have 1 AAPL which I bought at $10 and now I sell it for $20.
I'd say:
    Assets:Investments      -1 AAPL {$10.00} @ $20.00

What is the price and what the cost?  Is $10 really the price and $20 the
cost according to ledger?  I'd expect the exact opposite.  ledger -B shows
$-20 while -I shows $-10.

But surely the cost was $10 and the price $20...

-B stands for cost basis and the cost basis is what I paid for
something, not what I received for it.

Can someone enlighten me?

By the way, I'm asking these questions because of bug 713:
http://bugs.ledger-cli.org/show_bug.cgi?id=713

-- 
Martin Michlmayr
http://www.cyrius.com/

Reply via email to