Skip to content

Commit

Permalink
Fixed a bug with comparison of transactionIDs (#101)
Browse files Browse the repository at this point in the history
* Fixed a bug with comparison of transactionIDs:

Bug:
transactionIDs were lexicograpically compared as strings
instead of by their numerical value.

Explanation:
The usual case is that the transactionIDs of the witholding
tax and the dividend are close - meaning that they have the
same number of digits. Hence the original code worked most
of the time, because lexicograpical comparison is the same
as numerical when the numbers have the same number of digits.

* Added companies and missing conid
  • Loading branch information
ZigaSajovic authored Jul 20, 2023
1 parent 4308ef6 commit 1170e17
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
26 changes: 26 additions & 0 deletions companies.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<companies>
<company>
<conid>13013300</conid>
<symbol>APC</symbol>
<name>Apple Inc</name>
<taxNumber>942404110</taxNumber>
<address>1 Infinite Loop, Cupertino, CA 95014</address>
<country>US</country>
</company>
<company>
<conid>265598</conid>
<symbol>AAPL</symbol>
Expand Down Expand Up @@ -77,6 +85,7 @@
<country>US</country>
</company>
<company>
<conid>12973838</conid>
<symbol>JNJ</symbol>
<name>Johnson &amp; Johnson</name>
<taxNumber>221024240</taxNumber>
Expand Down Expand Up @@ -107,6 +116,14 @@
<address>3m Center 224-2w-15, St. Paul, MN 55144-1000</address>
<country>US</country>
</company>
<company>
<conid>12178239</conid>
<symbol>MSF</symbol>
<name>Microsoft Corp</name>
<taxNumber>911144442</taxNumber>
<address>One Microsoft Way, Redmond, WA 98052-6399</address>
<country>US</country>
</company>
<company>
<conid>272093</conid>
<symbol>MSFT</symbol>
Expand Down Expand Up @@ -789,6 +806,14 @@
<address>Foot Locker, Inc., 330 West 34th Street, New York, NY 10001</address>
<country>US</country>
</company>
<company>
<conid>128884495</conid>
<symbol>VUSA</symbol>
<name>Vanguard S&amp;P 500 UCITS ETF</name>
<taxNumber>00B3XXRP09</taxNumber>
<address>70 Sir John Rogerson's Quay Dublin 2 Ireland</address>
<country>IE</country>
</company>
<company>
<symbol>VWRD</symbol>
<name>Vanguard FTSE All-World UCITS ETF</name>
Expand Down Expand Up @@ -1304,6 +1329,7 @@
<country>US</country>
</company>
<company>
<conid>8894</conid>
<symbol>KO</symbol>
<name>The Coca-Cola Company</name>
<taxNumber>876272550</taxNumber>
Expand Down
4 changes: 2 additions & 2 deletions ib_edavki.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,8 +1141,8 @@ def main():
dividend["dateTime"][0:8]
== ibCashTransaction.attrib["dateTime"][0:8]
and dividend["symbol"] == ibCashTransaction.attrib["symbol"]
and dividend["transactionID"]
< ibCashTransaction.attrib["transactionID"]
and int(dividend["transactionID"])
< int(ibCashTransaction.attrib["transactionID"])
):
potentiallyMatchingDividends.append(dividend)

Expand Down

0 comments on commit 1170e17

Please sign in to comment.