Skip to content
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

Dividend withholding tax not taken into account in some cases #136

Open
ddbk opened this issue May 20, 2024 · 2 comments
Open

Dividend withholding tax not taken into account in some cases #136

ddbk opened this issue May 20, 2024 · 2 comments

Comments

@ddbk
Copy link
Contributor

ddbk commented May 20, 2024

Withholding tax is not accounted for in some cases. In my case, I had a dividend that was paid like this:

<CashTransaction accountId="UXXXXXXX" acctAlias="" model="" currency="CAD" fxRateToBase="0.69347" assetCategory="STK" symbol="TAL" description="TAL (CA71677J1012) CASH DIVIDEND CAD 0.033828 (Ordinary Dividend)" conid="320362585" securityID="CA71677J1012" securityIDType="ISIN" cusip="" isin="CA71677J1012" listingExchange="TSE" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="20230915;202000" settleDate="20230915" amount="456.61" type="Dividends" tradeID="" code="" transactionID="579312265" reportDate="20230918" clientReference="" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0" actionID="125883467" subCategory="COMMON" figi="BBG000BCP413" issuerCountryCode="" />
<CashTransaction accountId="UXXXXXXX" acctAlias="" model="" currency="CAD" fxRateToBase="0.69347" assetCategory="STK" symbol="TAL" description="TAL (CA71677J1012) CASH DIVIDEND CAD 0.0338275 - REVERSAL (Ordinary Dividend)" conid="320362585" securityID="CA71677J1012" securityIDType="ISIN" cusip="" isin="CA71677J1012" listingExchange="TSE" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="20230915;202000" settleDate="20230915" amount="-456.61" type="Dividends" tradeID="" code="" transactionID="579616301" reportDate="20230918" clientReference="" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0" actionID="125883467" subCategory="COMMON" figi="BBG000BCP413" issuerCountryCode="" />
<CashTransaction accountId="UXXXXXXX" acctAlias="" model="" currency="CAD" fxRateToBase="0.69347" assetCategory="STK" symbol="TAL" description="TAL (CA71677J1012) CASH DIVIDEND CAD 0.0338275 (Ordinary Dividend)" conid="320362585" securityID="CA71677J1012" securityIDType="ISIN" cusip="" isin="CA71677J1012" listingExchange="TSE" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="20230915;202000" settleDate="20230915" amount="456.6" type="Dividends" tradeID="" code="" transactionID="579616302" reportDate="20230918" clientReference="" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0" actionID="125883467" subCategory="COMMON" figi="BBG000BCP413" issuerCountryCode="" />

The withholding tax that was related to this dividend was:

<CashTransaction accountId="UXXXXXXX" acctAlias="" model="" currency="CAD" fxRateToBase="0.69347" assetCategory="STK" symbol="TAL" description="TAL (CA71677J1012) CASH DIVIDEND CAD 0.033828 PAYMENT IN LIEU OF DIVIDEND - US TAX" conid="320362585" securityID="CA71677J1012" securityIDType="ISIN" cusip="" isin="CA71677J1012" listingExchange="TSE" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="20230915;202000" settleDate="20230915" amount="-0.01" type="Withholding Tax" tradeID="" code="" transactionID="579312264" reportDate="20230918" clientReference="" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0" actionID="125883467" subCategory="COMMON" figi="BBG000BCP413" issuerCountryCode="" />
<CashTransaction accountId="UXXXXXXX" acctAlias="" model="" currency="CAD" fxRateToBase="0.69347" assetCategory="STK" symbol="TAL" description="TAL (CA71677J1012) CASH DIVIDEND CAD 0.033828 - US TAX" conid="320362585" securityID="CA71677J1012" securityIDType="ISIN" cusip="" isin="CA71677J1012" listingExchange="TSE" underlyingConid="" underlyingSymbol="" underlyingSecurityID="" underlyingListingExchange="" issuer="" multiplier="1" strike="" expiry="" putCall="" principalAdjustFactor="" dateTime="20230915;202000" settleDate="20230915" amount="-68.49" type="Withholding Tax" tradeID="" code="" transactionID="579312266" reportDate="20230918" clientReference="" levelOfDetail="DETAIL" serialNumber="" deliveryType="" commodityType="" fineness="0.0" weight="0.0" actionID="125883467" subCategory="COMMON" figi="BBG000BCP413" issuerCountryCode="" />

We need to look into this before the next tax season to not pay more taxes than required.

@RokLenarcic
Copy link

The problem with this particular set of data is that it's wrong.

Here's the sequence of events as far as I can understand them:

TAL (CA71677J1012) CASH DIVIDEND CAD 0.0338275 (Ordinary Dividend)
TAL (CA71677J1012) CASH DIVIDEND CAD 0.0338275 - REVERSAL (Ordinary Dividend)
TAL (CA71677J1012) CASH DIVIDEND CAD 0.033828 (Ordinary Dividend)

But the quantities are:

456.6
-456.61
456.61

So the reversal quantity does not match the dividend it's reversing.

The current code will match taxes with dividends one to one, but there seems to be 2 tax entries here for one actual dividend. It's not clear if tax entries can relate to reversed dividends.

I guess one solution would be to just roll together all the dividends and taxes related to same stock and same day into one entry. But that wouldn't really work if reversal is done on another day.

The code links a tax entry to the first entry, which gets reversed and then a new one is made.

@RokLenarcic
Copy link

Also the current code will match tax to a dividend with lower transaction ID.

https://github.com/jamsix/ib-edavki/blob/master/ib_edavki.py#L1158

Now if we look at the transactions, sorted by ID, your case, the order of events is nonsensical:

TAL (CA71677J1012) CASH DIVIDEND CAD 0.033828 PAYMENT IN LIEU OF DIVIDEND - US TAX
TAL (CA71677J1012) CASH DIVIDEND CAD 0.033828 (Ordinary Dividend)
TAL (CA71677J1012) CASH DIVIDEND CAD 0.033828 - US TAX
TAL (CA71677J1012) CASH DIVIDEND CAD 0.0338275 - REVERSAL (Ordinary Dividend)
TAL (CA71677J1012) CASH DIVIDEND CAD 0.0338275 (Ordinary Dividend)

So it seems we cannot rely on IBKR to have these in a proper order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@RokLenarcic @ddbk and others