Skip to content

Commit

Permalink
Merge pull request #106 from CatalinGB/master
Browse files Browse the repository at this point in the history
Some of the dividends don't have the "PER SHARE" sub-string
  • Loading branch information
tarioch authored Jan 7, 2024
2 parents 9612ae9 + 5a6893b commit a95ac4e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/tariochbctools/importers/ibkr/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ def file_account(self, file):

def matches(self, trx, t, account):
p = re.compile(r".* (?P<perShare>\d+\.?\d+) PER SHARE")
trxPerShare = p.search(trx.description).group("perShare")
tPerShare = p.search(t["description"]).group("perShare")

trxPerShareGroups = p.search(trx.description)
tPerShareGroups = p.search(t["description"])

trxPerShare = trxPerShareGroups.group("perShare") if trxPerShareGroups else ""
tPerShare = tPerShareGroups.group("perShare") if tPerShareGroups else ""

return (
t["date"] == trx.dateTime
Expand Down

0 comments on commit a95ac4e

Please sign in to comment.