diff --git a/pytr/event.py b/pytr/event.py index cd64ad9..98e89a9 100644 --- a/pytr/event.py +++ b/pytr/event.py @@ -88,6 +88,7 @@ class PPEventType(EventType): "TAX_REFUND": PPEventType.TAX_REFUND, # Trade invoices "BENEFITS_SPARE_CHANGE_EXECUTION": ConditionalEventType.TRADE_INVOICE, + "IPO_SUBSCRIPTION_ALLOCATION": ConditionalEventType.TRADE_INVOICE, "IPO_TRADE_EXECUTED": ConditionalEventType.TRADE_INVOICE, "ORDER_EXECUTED": ConditionalEventType.TRADE_INVOICE, "SAVINGS_PLAN_EXECUTED": ConditionalEventType.TRADE_INVOICE, @@ -415,7 +416,7 @@ def from_dict(cls, event_dict: Dict[Any, Any]): ititle = item.get("title") if ititle == "Gesamt": gesamt_dict = item - elif ititle == "Gebühr" and not fees_dict: + elif ititle in ["Gebühr", "Entgelt"] and not fees_dict: fees_dict = item elif ititle in ["Steuer", "Steuern"] and not taxes_dict: taxes_dict = item @@ -438,7 +439,7 @@ def from_dict(cls, event_dict: Dict[Any, Any]): for section in sections: if section.get("type") == "table": for subitem in section.get("data", []): - if subitem.get("title") == "Aktien" and not shares_dict: + if subitem.get("title") in ["Aktien", "Anteile"] and not shares_dict: shares_dict = subitem elif subitem.get("title") == "Quotation" and not quotation_dict: quotation_dict = subitem diff --git a/tests/events/ipo-subscription-allocation.json b/tests/events/ipo-subscription-allocation.json new file mode 100644 index 0000000..f7861ee --- /dev/null +++ b/tests/events/ipo-subscription-allocation.json @@ -0,0 +1,233 @@ +{ + "id": "7cc530d5-e4af-412e-a9cf-b2bff8a69cbf", + "timestamp": "2026-11-19T07:50:00.000+0000", + "title": "Anthropic", + "icon": "logos/US03703U1079/v2", + "avatar": { + "asset": "logos/US03703U1079/v2", + "badge": null + }, + "badge": null, + "subtitle": "IPO Zuteilung", + "amount": { + "currency": "EUR", + "value": -152.32, + "fractionDigits": 2 + }, + "subAmount": null, + "status": "EXECUTED", + "action": { + "type": "timelineDetail", + "payload": "7cc530d5-e4af-412e-a9cf-b2bff8a69cbf" + }, + "cashAccountNumber": "123456789", + "hidden": false, + "deleted": false, + "eventType": "IPO_SUBSCRIPTION_ALLOCATION", + "actor": null, + "presentation": { + "leading": { + "type": "avatar", + "icon": "logos/US03703U1079/v2" + }, + "content": { + "type": "default", + "title": "Anthropic", + "subtitle": "19 Nov. · IPO Zuteilung" + }, + "trailing": { + "type": "value", + "title": "152,32 €", + "titleColor": "default", + "strikethrough": false, + "titleDataSensitivity": "SENSITIVE" + }, + "action": { + "type": "timelineDetail", + "payload": "7cc530d5-e4af-412e-a9cf-b2bff8a69cbf" + }, + "type": "listItem" + }, + "source": "timelineTransaction", + "details": { + "id": "7cc530d5-e4af-412e-a9cf-b2bff8a69cbf", + "sections": [ + { + "title": "Du hast 152,32 € investiert", + "data": { + "icon": { + "asset": "logos/US03703U1079/v2", + "badge": null + }, + "subtitleText": "19 Nov. · 10:57", + "status": "executed" + }, + "type": "header" + }, + { + "title": "Dein Anthropic Investment", + "description": "Du hast Anthropic-Aktien im Wert von 151,32 € erhalten. Den nicht zugeteilten Zeichnungsbetrag in Höhe von 348,68 € haben wir dir erstattet.", + "type": "banner" + }, + { + "title": "Übersicht", + "data": [ + { + "title": "IPO Zeichnung", + "detail": { + "text": "Ausgeführt", + "functionalStyle": "EXECUTED", + "type": "status" + }, + "style": "plain" + }, + { + "title": "Asset", + "detail": { + "text": "Anthropic", + "displayValue": { + "text": "Anthropic", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Transaktion", + "detail": { + "text": "2 × 75,659514 €", + "action": { + "type": "infoPage", + "payload": { + "id": "00000000-0000-0000-0000-000000000000", + "sections": [ + { + "title": "Transaktion", + "data": { + "status": "executed" + }, + "type": "header" + }, + { + "data": [ + { + "title": "Aktienkurs", + "detail": { + "text": "75,659514 €", + "displayValue": { + "text": "75,659514 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Anteile", + "detail": { + "text": "2", + "displayValue": { + "text": "2", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Gesamt", + "detail": { + "text": "151,32 €", + "displayValue": { + "text": "151,32 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + } + ], + "type": "table" + } + ] + }, + "displayMode": "bottomSheet" + }, + "displayValue": { + "text": "75,659514 €", + "prefix": "2 × ", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Entgelt", + "detail": { + "text": "1,00 €", + "displayValue": { + "text": "1,00 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Gesamt", + "detail": { + "text": "152,32 €", + "displayValue": { + "text": "152,32 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + } + ], + "type": "table" + }, + { + "title": "Dokumente", + "data": [ + { + "title": "Wertpapierabrechnung", + "action": { + "payload": "https://example.com/document.pdf", + "type": "browserModal" + }, + "id": "25e96768-e4f7-416b-9fd7-8360a2f32782", + "postboxType": "SECURITIES_SETTLEMENT" + }, + { + "title": "Prospekt", + "action": { + "payload": "https://assets.traderepublic.com/assets/files/TR_EU_Prospectus_3xkgCuxPiZw.pdf", + "type": "browserModal" + }, + "id": "6e77462a-1ee5-3c44-afd1-990d8d7eec7a", + "postboxType": "IPO_PROSPECTUS" + }, + { + "title": "Ex-Ante Kosteninformation zum Wertpapierkauf", + "action": { + "payload": "https://example.com/document.pdf", + "type": "browserModal" + }, + "id": "1e1479aa-68de-4f49-bb0c-2a8053267cb4", + "postboxType": "EQUITIES_BUY_EX_ANTE" + } + ], + "type": "documents" + }, + { + "text": "The sale of the shares has been made in connection with a U.S. registration statement.", + "style": "disclaimer", + "type": "text" + } + ] + } +} diff --git a/tests/test_events.py b/tests/test_events.py index 63f217b..f334fc5 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -894,6 +894,26 @@ "value": None, "transactions": [], }, + { + "filename": "ipo-subscription-allocation.json", + "event_type": ConditionalEventType.TRADE_INVOICE, + "title": "Anthropic", + "isin": "US03703U1079", + "shares": 2.0, + "value": -152.32, + "fees": 1.0, + "transactions": [ + { + "Datum": "2026-11-19T07:50:00", + "Typ": "Kauf", + "Wert": -152.32, + "Notiz": "Anthropic", + "ISIN": "US03703U1079", + "Stück": 2.0, + "Gebühren": 1.0, + } + ], + }, { "filename": "junior_p2p_transfer.json", "event_type": PPEventType.REMOVAL,