diff --git a/pytr/event.py b/pytr/event.py index 0aa8825..243090d 100644 --- a/pytr/event.py +++ b/pytr/event.py @@ -469,16 +469,10 @@ def from_dict(cls, event_dict: Dict[Any, Any]): elif eventTypeStr in ["SSP_CORPORATE_ACTION_INVOICE_CASH", "SSP_CORPORATE_ACTION_CASH"]: if subtitle == "Aufruf von Zwischenpapieren": event_type = PPEventType.SWAP - elif subtitle in [ - "Aktienprämiendividende", - "Bardividende", - "Bardividende korrigiert", - "Dividende Wahlweise", - "Tilgung", - ]: - event_type = PPEventType.DIVIDEND - else: + elif value is not None and value < 0: event_type = PPEventType.TAXES + else: + event_type = PPEventType.DIVIDEND # Now try to deduct the event type from the title if we still don't have one if event_type is None and eventTypeStr not in events_known_ignored: diff --git a/tests/events/vorabpauschale_negative.json b/tests/events/vorabpauschale_negative.json new file mode 100644 index 0000000..3ebcbbe --- /dev/null +++ b/tests/events/vorabpauschale_negative.json @@ -0,0 +1,142 @@ +{ + "id": "61373a0b-3574-31be-855f-53edf4976c8f", + "timestamp": "2025-01-28T14:30:05.259+0000", + "title": "S&P 400 US Mid Cap (Acc)", + "icon": "logos/IE00B4YBJ215/v2", + "avatar": { + "asset": "logos/IE00B4YBJ215/v2", + "badge": null + }, + "badge": null, + "subtitle": "Vorabpauschale", + "amount": { + "currency": "EUR", + "value": -0.04, + "fractionDigits": 2 + }, + "subAmount": null, + "status": "EXECUTED", + "action": { + "type": "timelineDetail", + "payload": "61373a0b-3574-31be-855f-53edf4976c8f" + }, + "cashAccountNumber": "123456789", + "hidden": false, + "deleted": false, + "eventType": "SSP_CORPORATE_ACTION_CASH", + "source": "timelineTransaction", + "details": { + "id": "61373a0b-3574-31be-855f-53edf4976c8f", + "sections": [ + { + "title": "Du hast -0,04 € bezahlt", + "data": { + "icon": { + "asset": "logos/IE00B4YBJ215/v2", + "badge": null + }, + "subtitleText": "28 Jan. 2025 · 14:30", + "status": "executed" + }, + "type": "header" + }, + { + "title": "Übersicht", + "data": [ + { + "title": "Status", + "detail": { + "text": "Ausgeführt", + "functionalStyle": "EXECUTED", + "type": "status" + }, + "style": "plain" + }, + { + "title": "Event", + "detail": { + "text": "Vorabpauschale", + "displayValue": { + "text": "Vorabpauschale", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Wertpapier", + "detail": { + "text": "S&P 400 US Mid Cap (Acc)", + "displayValue": { + "text": "S&P 400 US Mid Cap (Acc)", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + } + ], + "type": "table" + }, + { + "title": "Geschäft", + "data": [ + { + "title": "Bruttoertrag", + "detail": { + "text": "0,00 €", + "displayValue": { + "text": "0,00 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Steuer", + "detail": { + "text": "-0,04 €", + "displayValue": { + "text": "-0,04 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Gesamt", + "detail": { + "text": "-0,04 €", + "displayValue": { + "text": "-0,04 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + } + ], + "type": "table" + }, + { + "title": "Dokumente", + "data": [ + { + "title": "Vorabpauschale", + "detail": "28.01.2025", + "action": { + "payload": "https://example.com/vorabpauschale.pdf", + "type": "browserModal" + }, + "id": "2e2ce1bd-6149-4ad6-9483-a57e619ca5d7", + "postboxType": "CA_VOPA_INVOICE" + } + ], + "type": "documents" + } + ] + } +} diff --git a/tests/test_events.py b/tests/test_events.py index 67c5dad..13d8796 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -2618,6 +2618,24 @@ } ], }, + { + "filename": "vorabpauschale_negative.json", + "event_type": PPEventType.TAXES, + "title": "S&P 400 US Mid Cap (Acc)", + "isin": "IE00B4YBJ215", + "value": -0.04, + "taxes": 0.04, + "transactions": [ + { + "Datum": "2025-01-28T14:30:05", + "Typ": "Steuern", + "Wert": -0.04, + "Notiz": "S&P 400 US Mid Cap (Acc)", + "ISIN": "IE00B4YBJ215", + "Steuern": 0.04, + } + ], + }, ]