fixed lot prices

65 views
Skip to first unread message

Tavis Ormandy

unread,
Jan 3, 2024, 2:50:40 PMJan 3
to ledge...@googlegroups.com
Hello, I'm not sure I understand the Fixed Lot Prices section of the manual:

https://ledger-cli.org/doc/ledger3.html#Fixing-Lot-Prices

Specifically, this example transaction in section 4.5.3:

Expenses:Gasoline 11 GAL {=$2.299} @ $2.30

The manual says "This transaction says that you bought 11 gallons priced
at $2.299 per gallon at a cost to you of $2.30 per gallon.". I interpret
that to mean I paid $2.30 per gallon, but the gas is worth $2.299 per
gallon, but that's not what happens:

$ ledger --file fixedlot.ldg reg
09-Jan-01 Shell Expenses:Gasoline 11 GAL {=$2.299} 11 GAL {=$2.299}
Assets:Checking $-25.29 $-25.29
11 GAL {=$2.299}

Shouldn't it debit the checking account (11 * $2.30) = $25.30, not ($11 *
$2.299) = $25.29?

I don't care about gas, but I thought this might be an interesting way
to represent treasury bills you intend to hold to maturity. These are
sold at a discount, i.e. a treasury bill with a face value of $100 might
be sold for $95, so you could write this:

2024/01/01 Investment
Assets:Broker 100 USTBILL {=$1} @ $0.95
Assets:Checking

The intention is that if you do bal -X '$', it shows me $100, but only
debits checking $95 on purchase.

I dunno if that makes sense, I'm not a finance guy, maybe I'm doing this
the naive way! How do other people represent them? :)

Tavis.

--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger tav...@sdf.org
_\_V _( ) _( ) @taviso

Tavis Ormandy

unread,
Jan 3, 2024, 4:20:12 PMJan 3
to ledge...@googlegroups.com
On 2024-01-03, Tavis Ormandy wrote:
> The intention is that if you do bal -X '$', it shows me $100, but only
> debits checking $95 on purchase.
>

I think I figured out a way to do this, here is a solution:


= expr (commodity == 'USTBILL')
; VALUE:: $1

2009/01/01 Buy
Assets:Broker 100 USTBILL @ $0.95
Assets:Checking

2009/02/01 Sell
Assets:Broker -100 USTBILL {$0.95} [2009/01/01] @ $1
Assets:Checking $100
Income:Capital Gains


I don't know if this is the "right" way to record these transactions, but
the output makes sense to me?

I'm not 100% convinced the fixed lot pricing feature is working as intended...

John Wiegley

unread,
Jan 5, 2024, 7:56:11 PMJan 5
to Tavis Ormandy, ledge...@googlegroups.com
>>>>> "TO" == Tavis Ormandy <tav...@gmail.com> writes:

TO> 09-Jan-01 Shell Expenses:Gasoline 11 GAL {=$2.299} 11 GAL {=$2.299}
TO> Assets:Checking $-25.29 $-25.29
TO> 11 GAL {=$2.299}
TO>
TO> Shouldn't it debit the checking account (11 * $2.30) = $25.30, not ($11 *
TO> $2.299) = $25.29?

Yes, according to the text in the manual it sounds like it should be $25.30.

John
Reply all
Reply to author
Forward
0 new messages