Possible bug with fixed lot pricing

37 views
Skip to first unread message

Pranshu Goyal

unread,
Apr 5, 2024, 12:33:24 AMApr 5
to Ledger
Let's consider this posting for a company's stock grant:

2024/04/01 * Acme
  Assets                                                                       7 ACM @ $10
  Tax                                                                             3 ACM @ = $10
  Income                                                                    -$100
 
P 2024/04/04 ACM $15

Here, the intention is to fix the price of stock used to pay tax, so balance reports in future report the same tax amount in dollar values even after stock price changes.

Hence the command after price changes to $15:
ledger bal Tax -V
gives:
$30 Tax 

Which follows the expectation. Now lets look at balance report for Assets asked after the price changed on 4th April 2024:
ledger bal Assets -V
this produces 
$70 Assets

This in my opinion is unexpected behavior.  I used fixed lot price syntax to fix the price for Tax but not for Assets, but it also fixed the price for assets. I'm not sure if I'm doing something wrong here or if it is a bug.

Pranshu Goyal

Igbanam Ogbuluijah

unread,
May 18, 2024, 11:13:10 AMMay 18
to Ledger
Ah! I see what it is. — There's pricing information, but ledger doesn't know what to do with it.

I modified the ledger to add some transactions after the pricing information changed.

2024/04/01 * Acme
    Assets    7 ACM @ $10
    Tax       3 ACM @ = $10
    Income
 
P 2024/04/04 ACM $15
2024/04/04 ACM Spend
    Expenses  1 ACM
    Assets


With this, when you run the balance report with ledger -f file.ledger balance -X $, you see the price is used in the next transaction.

                 $55  Assets
                 $15  Expenses
               $-100  Income
                 $30  Tax
--------------------
                   0


Again, if there's some way to see the realtime value of a commodity, I don't currently know this. But I've just realized if there's a transaction after the pricing information, ledger will use that most recent pricing information.

Hope this helps clarify.


- Igbanam

Pranshu Goyal

unread,
May 20, 2024, 12:01:24 PMMay 20
to Ledger
This doesn't work as for the given example I expect Assets to be reported as $90 not $55. The reason being, after spending 1 ACM we have 6 ACM left in assets and the current price of ACM is $15. So 6 ACM should be reported as $90. Surprisingly in this example the Expenses is reported as $15 which matches the expectation.

Igbanam Ogbuluijah

unread,
May 22, 2024, 5:04:08 PMMay 22
to Ledger
So…

I've been doing some reading around this, and there are specific ways to record these sorts of transactions in ledger.

2024/04/01 * Acme
    Assets    7 ACM  @ $10
    Tax       3 ACM { = $10 }

    Income

P 2024/04/04 ACM $15
2024/04/04 ACM Spend
    Expenses  1 ACM
    Assets


  • 7 ACM was purchased and is held
  • 3 ACM was paid as tax at a fixed cost of 10 USD per ACM

Hope this helps 
Reply all
Reply to author
Forward
0 new messages