-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buy-side commissions not taken into account #1
Comments
Thanks for the questions, they point to some intricacies I'm not sure I can answer with confidence, but here is what I think I know: Possibly a better solution than the current one would be to join each lot with its matching entry in the commissions part of the CSV. I think that I think it might also solve the borrowing fees assuming the borrowing fees are included in the fees section, can you confirm that? |
In "my" report, the borrowing fees are grouped by month, .i.e.: But maybe there are settings in the report generation page that can cause them to be added to each closed lot. The fees section also include exchange fees that you can deduct as expenses: In my case they are mostly rebated by IB, not all of them. |
Regarding transaction fees ("Commision Details" section), both Broker Charges (execution + clearing) and Third-Party Charges (Execution, Clearing and Transaction Fees) are all summed together into the Commission column (that's what I noticed on a small example) and using the composite key I believe they can be matched to both the Trade and ClosedeLot. As the the borrowing fees, I'm not sure what's the correct way to present them, I'll have to check if the Date matches the date at which the borrowed asset was bought back, if so, I guess it can be added to the closing transaction*. If not, it might needs to go into a different row in the 1325, but I'm not sure how that should look like if it does not have both buy-side and sell side? I'm really not sure about that. Out of these two issues I'll prioritize changing how the commissions are calculated, taking the entire commissions into account (rather than just the closing trade commissions which is the current implementation). (*) I didn't mention it explicitly earlier, but the composite key that I suggested (symbol, date time, quantity) is not guaranteed to be unique if you're a high frequency trader. It is even less likely to be unique in the borrowing section since it only lists date rather than time, which lead me to suspect that it might not be linked directly to a transaction, but if the borrowing fee changes daily, that might not matter after all. |
After I tried to join the Trade schema with the Commission schema based on the (symbol, date, quantity) currency I found out two facets of the same thing which will add some complexity:
These lines, unlike the ClosedLot which may combine multiple buy-side trades with the same price, also have date and time. However, the entity that should be presented in the 1325 form is each of the (instrumented) ClosedLot, which means that each ClosedLot should be matched to the buying trade, hopefully this can be done based on (symbol, date). If we want to be accurate regarding varying commission rates across different orders (of the same symbol within the same day), we'll have to also update the remaining qty after matching each ClosedLot to its buy-side Trade row (assuming it's already already joined with the commission table), but that might be an overkill and we can assume that commissions should not vary wildly within the same day. |
C:\Users\jacob\Downloads\Files\IBKR-to-1325-form-main\IBKR-to-1325-form-main>python src |
@JacobPyC You're using an older version of Python which does not support type hinting generics in standard collections (e.g. Besides that, while I'd gladly try to assist you if you encounter further issues and despite the title ("Questions"), this isn't a catch-all issue for support (I'll change the title to reflect the nature of the issue I discussed with with @mirono here). If any further issue arise which you cannot find solution to, please open a new issue. |
I agree that same day stock commissions probably refer to the same closed lot. If overkill I would just add them to the nearest symbol, date closed lot. |
Great work! Not really an issue, but rather some questions:
The text was updated successfully, but these errors were encountered: