Closed b166er closed 4 months ago
Thanks for the issue report. I stumbled across the same error. I had to amend your proposed solution slightly: Either add
import re
or add
from re import sub
and subsequently modify
self.shares = re.sub('[^\.\d-]', '', self.shares)
to
self.shares = sub('[^\.\d-]', '', self.shares)
This is what I needed what I needed to get pytr running on my barebones windows Python 3.11.5 version.
Fixed in #106
Description of the bug
Sometimes (at corporate bonds) a € sign appears next to a number in the event/details/sections/"Transaktionen"/data/detail/text. In transactions line 70 event.shares tries to format, the character causes an exception. the event.shartes are string-replaced from comma to dot in event.py line 69 to get a valid number. i guess you also have to remove the euro-sign to keep the number valid.
To Reproduce you have to buy a corporate bond, then you get the following subnode in the “events” in the API return:
"details": {"sections": [{"title": "Transaktion","data": [{"title": "*", "detail": {"text": "1,00 €",..."type": "text"
here is the full dataset of this event (anonymized)
Expected behavior no exception, all cases need to be replaced for clean number.
Error log
Proposed solution in event.py line 69
I'm not sure, maybe there are other currency signs that could be there.
Environment