Automatically combining trade transactions

67 views
Skip to first unread message

Eric Altendorf

unread,
Aug 20, 2024, 7:28:19 PM8/20/24
to bean...@googlegroups.com
Let's say you're importing transactions from a broker.  Further imagine that a trade you made had been split into a large number of transactions for execution.  They're all at nearly the same time, with nearly the same price, and for very small lots.

What would be the recommended way to combine these into one transaction in Beancount?  Is there a plugin?  Would it make more sense to do in the importer?

eric

Martin Blais

unread,
Aug 21, 2024, 2:12:49 AM8/21/24
to Beancount
It depends on your goal. Do you want to represent all the execution details in your ledger or are you okay with a summarization that is slightly inaccurate but whose final result numbers are the same?

TD actually does this within its systems: depending on where you are getting the data from - thinkorswim vs. its website, and now its Schwab website which has yet different results - you will get one or the other, I think the website gives you a single summarized execution and thinkorswim had the individual executions. Another example of a discrepancy: if you but a t-bill with an accrued coupon amount to pay, on the website this will be reflected accurately but downloading from thinkorswim you won't see the accrued amount reflected. 
Instead they patch it up with some adjustment later on. This means some of the balances are temporarily incorrect. I've encountered these issues when importing data in Johnny. 

I think if you have correct groupings of these related executions it's totally fine to summarize them. Because the Beancount balances operate on a day time resolution you wouldn't even have temporarily inaccurate balances. But then you wouldn't have the execution detail. In Johnny I keep all the detail, in Beancount I don't.





--
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/CAFXPr0sMup8aEtdTQqvZOjYCnbV-S_NjE_70uwy-%2B1sZSCg5KQ%40mail.gmail.com.

Eric Altendorf

unread,
Aug 22, 2024, 12:25:01 PM8/22/24
to bean...@googlegroups.com
Yeah, I guess I'm struggling with the decision because I don't have a strong basis for doing one or the other.  Aside from my general attachment to modeling accurately, I can't think of anything I would actually do with the information that between 10:21AM and 10:25AM my order was executed in 20 different transactions at slightly different prices, versus one execution at the average price.

In the end, mostly because it seemed to be easier to implement, I ended up keeping the full transaction resolution through the ledger and booking, and only clustering transactions on the final 8949 report.  This does mean that my individual lot booking reports remain verbose and complex though.


Reply all
Reply to author
Forward
0 new messages