Hello ledger devs & users,

Does posting order affect stock or commodity cost basis in Ledger?

Looking at the first example in section 4.5.2 of the documentation[1], one 
finds this example:

2004/05/01 Stock purchase
>     Assets:Broker                     50 AAPL @ $30.00
>     Expenses:Broker:Commissions        $19.95
>     Assets:Broker                  $-1,519.95
>
>
Running  a balance command with the '--lots' flag yields the expected AAPL 
@ $30.00 as follows, whether or not we specify "@ $30.00" in the AAPL 
purchase posting:

$ ledger -f temp.ledger bal --lots
>            $-1,519.95
> 50 AAPL {$30.00} [2004-05-01]  Assets:Broker
>               $19.95  Expenses:Broker:Commissions
> --------------------
>            $-1,500.00
> 50 AAPL {$30.00} [2004-05-01]
>
>
If the ledger journal lists the broker's commission first, as follows, the 
output is still the same as above, but only if we specify the "@ $30.00".

2004/05/01 Stock purchase
>
>     Expenses:Broker:Commissions        $19.95
>     Assets:Broker                     50 AAPL @ $30.00
>     Assets:Broker                  $-1,519.95
>
>
Instead, if we run the following input

2004/05/01 Stock purchase
>
>     Expenses:Broker:Commissions        $19.95
>     Assets:Broker                     50 AAPL
>     Assets:Broker                  $-1,519.95
>
>
the output with the '--lots' flag will show $1500 in terms of AAPL shares:

$ ledger -f temp.ledger bal --lots
> $-1,519.95 {0.0333333333333333 AAPL} [2004-05-01]
>              50 AAPL  Assets:Broker
> $19.95 {0.0333333333333333 AAPL} [2004-05-01]  Expenses:Broker:Commissions
> --------------------
> $-1,500.00 {0.0333333333333333 AAPL} [2004-05-01]
>              50 AAPL
>
>
Is that really the desired behavior, where changing the order of postings 
changes the items for which ledger tracks lots? Does this have something to 
do with which postings are considered primary and secondary in a 
transaction with three or more postings?

Additionally, the lot information isn't including the brokerage fee. Is 
there a way to include this in ledger's cost basis? Wouldn't the cost basis 
for these 50 shares of AAPL be $30.399, which includes the brokerage fee? 
Or would that violate ledger's principle of simply being a calculator and 
not forcing any particular accounting strategy on anyone?

Thanks! 

FYI, I'm running Ledger 3.1.2-20190205.


[1] https://www.ledger-cli.org/3.0/doc/ledger3.html#Buying-and-Selling-Stock

-- 

--- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/cc76740c-8b40-4588-ab66-67f2e43f0003%40googlegroups.com.

Reply via email to