Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions pytr/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
142 changes: 142 additions & 0 deletions tests/events/vorabpauschale_negative.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
}
18 changes: 18 additions & 0 deletions tests/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
],
},
]


Expand Down