Lot matching necessary?

92 views
Skip to first unread message

Dan Andersson

unread,
Nov 21, 2023, 11:36:11 AM11/21/23
to Beancount
Hi,

My goal is to convert Interactive Brokers statements (their XML flex statements) to Beancount.

Normally I wouldn't have to think about lots and prices, because each <Trade ... /> already tells me cash in/out (and realized FIFO pnl).

So I already know exactly the amount that leaves/enters the cash account and exactly the quantity that enters/leaves the financial instrument account.

From what I currently understand, it's only because of Beancount peculiarity that I need to go through the trouble of matching the individual lots. Normally, there would not be much point in doing that (at most, I'd only want "price" commands at the end of the year to get my **unrealized** PnL).

Is my understanding correct? Or can lots somehow already been auto-matched according to e.g. FIFO?

Thanks,
Dan

Martin Blais

unread,
Nov 21, 2023, 8:55:10 PM11/21/23
to bean...@googlegroups.com
On Tue, Nov 21, 2023 at 11:36 AM Dan Andersson <danande...@gmail.com> wrote:
Hi,

My goal is to convert Interactive Brokers statements (their XML flex statements) to Beancount.

Normally I wouldn't have to think about lots and prices, because each <Trade ... /> already tells me cash in/out (and realized FIFO pnl).

If they're booked FIFO you should be able to find the matching lots.
You can also use Beancounts' automatic FIFO booking by specifying it on the account, hopefully it should match those.

 

So I already know exactly the amount that leaves/enters the cash account and exactly the quantity that enters/leaves the financial instrument account.

From what I currently understand, it's only because of Beancount peculiarity that I need to go through the trouble of matching the individual lots. Normally, there would not be much point in doing that (at most, I'd only want "price" commands at the end of the year to get my **unrealized** PnL).

Is my understanding correct? Or can lots somehow already been auto-matched according to e.g. FIFO?

Yeah, just specify "FIFO" on the account.


 

Thanks,
Dan

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/5003ba33-e6fd-4553-b3c8-1568afda1504n%40googlegroups.com.

nug get

unread,
Nov 21, 2023, 11:44:59 PM11/21/23
to Beancount
Hi Dan

My goal is to convert Interactive Brokers statements (their XML flex statements) to Beancount.
have a look at https://github.com/Dr-Nuke/drnuke-bean/blob/master/src/drnukebean/importer/ibkr.py
It's been a while, but if I remember correctly, it does the job of finding the correct lots for selling.
Best,
Nugget
 
Reply all
Reply to author
Forward
0 new messages