From 67e4249defd42e8bd81e252cec6c7d9dc38f9d77 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Wed, 18 Nov 2026 21:25:28 +0100 Subject: [PATCH] Add handling of some IPO events --- pytr/event.py | 2 + tests/events/ipo-anthropic-cancelled.json | 165 ++++++++++++++++++++++ tests/events/ipo-anthropic-created.json | 165 ++++++++++++++++++++++ tests/test_events.py | 18 +++ 4 files changed, 350 insertions(+) create mode 100644 tests/events/ipo-anthropic-cancelled.json create mode 100644 tests/events/ipo-anthropic-created.json diff --git a/pytr/event.py b/pytr/event.py index 86d503f..cd64ad9 100644 --- a/pytr/event.py +++ b/pytr/event.py @@ -202,6 +202,8 @@ class PPEventType(EventType): "GESH_CORPORATE_ACTION", "INPAYMENTS_SEPA_MANDATE_CREATED", "INSTRUCTION_CORPORATE_ACTION", + "IPO_SUBSCRIPTION_CANCELLED", + "IPO_SUBSCRIPTION_CREATED", "JUNIOR_ONBOARDING_GUARDIAN_B_CONSENT", "MATURITY", "NEW_TR_IBAN", diff --git a/tests/events/ipo-anthropic-cancelled.json b/tests/events/ipo-anthropic-cancelled.json new file mode 100644 index 0000000..0ae6073 --- /dev/null +++ b/tests/events/ipo-anthropic-cancelled.json @@ -0,0 +1,165 @@ +{ + "id": "1ef4d656-f308-467f-a132-32b346165860", + "timestamp": "2026-11-11T15:32:39.667+0000", + "title": "Anthropic", + "icon": "logos/US03703U1079/v2", + "avatar": { + "asset": "logos/US03703U1079/v2", + "badge": null + }, + "badge": null, + "subtitle": "Kauforder", + "amount": { + "currency": "EUR", + "value": -10.0, + "fractionDigits": 2 + }, + "subAmount": null, + "status": "CANCELED", + "action": { + "type": "timelineDetail", + "payload": "1ef4d656-f308-467f-a132-32b346165860" + }, + "cashAccountNumber": "123456789", + "hidden": false, + "deleted": false, + "eventType": "IPO_SUBSCRIPTION_CANCELLED", + "actor": null, + "presentation": { + "leading": { + "type": "avatar", + "icon": "logos/US03703U1079/v2" + }, + "content": { + "type": "default", + "title": "Anthropic", + "subtitle": "11 Nov. • Kauforder" + }, + "trailing": { + "type": "value", + "title": "10,00 €", + "titleColor": "default", + "strikethrough": true, + "titleDataSensitivity": "SENSITIVE" + }, + "action": { + "type": "timelineDetail", + "payload": "1ef4d656-f308-467f-a132-32b346165860" + }, + "type": "listItem" + }, + "source": "timelineTransaction", + "details": { + "id": "1ef4d656-f308-467f-a132-32b346165860", + "sections": [ + { + "title": "Du hast 10,00 € investiert", + "data": { + "icon": { + "asset": "logos/US03703U1079/v2", + "badge": null + }, + "subtitleText": "11 Nov. · 15:32", + "status": "canceled" + }, + "action": { + "payload": "US03703U1079", + "type": "instrumentDetail" + }, + "type": "header" + }, + { + "title": "Abonnement gekündigt", + "description": "Das Abo wurde gekündigt und du hast den vollständigen Abobetrag in Höhe von 10,00 € zurückerhalten.", + "type": "banner" + }, + { + "title": "Übersicht", + "data": [ + { + "title": "IPO", + "detail": { + "text": "Storniert", + "functionalStyle": "CANCELED", + "type": "status" + }, + "style": "plain" + }, + { + "title": "Asset", + "detail": { + "text": "Anthropic", + "displayValue": { + "text": "Anthropic", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Transaktion", + "detail": { + "text": "9,00 €", + "displayValue": { + "text": "9,00 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Gebühr", + "detail": { + "text": "1,00 €", + "displayValue": { + "text": "1,00 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Summe", + "detail": { + "text": "10,00 €", + "displayValue": { + "text": "10,00 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + } + ], + "type": "table" + }, + { + "title": "Dokumente", + "data": [ + { + "title": "Kosteninformation", + "action": { + "payload": "https://example.com/document.pdf", + "type": "browserModal" + }, + "id": "80d2c90d-5cba-4327-801c-41f03a4236e3", + "postboxType": "EQUITIES_BUY_EX_ANTE" + }, + { + "title": "Prospekt", + "action": { + "payload": "https://assets.traderepublic.com/assets/files/TR_EU_Prospectus_3xkgCuxPiZw.pdf", + "type": "browserModal" + }, + "id": "4b3b1e09-fd8d-38d7-9291-00de9b6a2cd1", + "postboxType": "" + } + ], + "type": "documents" + } + ] + } +} diff --git a/tests/events/ipo-anthropic-created.json b/tests/events/ipo-anthropic-created.json new file mode 100644 index 0000000..62b0ba0 --- /dev/null +++ b/tests/events/ipo-anthropic-created.json @@ -0,0 +1,165 @@ +{ + "id": "c734b1d3-4a6c-435a-a3aa-e97bedbb6104", + "timestamp": "2026-11-18T07:42:22.017+0000", + "title": "Anthropic", + "icon": "logos/US03703U1079/v2", + "avatar": { + "asset": "logos/US03703U1079/v2", + "badge": null + }, + "badge": null, + "subtitle": "Kauforder", + "amount": { + "currency": "EUR", + "value": -10.0, + "fractionDigits": 2 + }, + "subAmount": null, + "status": "EXECUTED", + "action": { + "type": "timelineDetail", + "payload": "c734b1d3-4a6c-435a-a3aa-e97bedbb6104" + }, + "cashAccountNumber": "123456789", + "hidden": false, + "deleted": false, + "eventType": "IPO_SUBSCRIPTION_CREATED", + "actor": null, + "presentation": { + "leading": { + "type": "avatar", + "icon": "logos/US03703U1079/v2" + }, + "content": { + "type": "default", + "title": "Anthropic", + "subtitle": "18 Nov. • Kauforder" + }, + "trailing": { + "type": "value", + "title": "10,00 €", + "titleColor": "default", + "strikethrough": false, + "titleDataSensitivity": "SENSITIVE" + }, + "action": { + "type": "timelineDetail", + "payload": "c734b1d3-4a6c-435a-a3aa-e97bedbb6104" + }, + "type": "listItem" + }, + "source": "timelineTransaction", + "details": { + "id": "c734b1d3-4a6c-435a-a3aa-e97bedbb6104", + "sections": [ + { + "title": "Du hast 10,00 € investiert", + "data": { + "icon": { + "asset": "logos/US03703U1079/v2", + "badge": null + }, + "subtitleText": "18 Nov. · 07:42", + "status": "executed" + }, + "action": { + "payload": "US03703U1079", + "type": "instrumentDetail" + }, + "type": "header" + }, + { + "title": "Auftrag platziert", + "description": "Du erhältst Aktien im Wert von bis zu 9,00 €. Über die tatsächliche Zuteilung informieren wir dich am Tag des Börsengangs.", + "type": "banner" + }, + { + "title": "Übersicht", + "data": [ + { + "title": "IPO Zeichnung", + "detail": { + "text": "Erstellt", + "functionalStyle": "CREATED", + "type": "status" + }, + "style": "plain" + }, + { + "title": "Asset", + "detail": { + "text": "Anthropic", + "displayValue": { + "text": "Anthropic", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Transaktion", + "detail": { + "text": "9,00 €", + "displayValue": { + "text": "9,00 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Gebühr", + "detail": { + "text": "1,00 €", + "displayValue": { + "text": "1,00 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + }, + { + "title": "Summe", + "detail": { + "text": "10,00 €", + "displayValue": { + "text": "10,00 €", + "textDataSensitivity": "PUBLIC" + }, + "type": "text" + }, + "style": "plain" + } + ], + "type": "table" + }, + { + "title": "Dokumente", + "data": [ + { + "title": "Kosteninformation", + "action": { + "payload": "https://example.com/document.pdf", + "type": "browserModal" + }, + "id": "1e1479aa-68de-4f49-bb0c-2a8053267cb4", + "postboxType": "EQUITIES_BUY_EX_ANTE" + }, + { + "title": "Prospekt", + "action": { + "payload": "https://assets.traderepublic.com/assets/files/TR_EU_Prospectus_3xkgCuxPiZw.pdf", + "type": "browserModal" + }, + "id": "4b3b1e09-fd8d-38d7-9291-00de9b6a2cd1", + "postboxType": "" + } + ], + "type": "documents" + } + ] + } +} diff --git a/tests/test_events.py b/tests/test_events.py index 8743c81..63f217b 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -876,6 +876,24 @@ } ], }, + { + "filename": "ipo-anthropic-cancelled.json", + "event_type": None, + "title": "Anthropic", + "isin": None, + "shares": None, + "value": None, + "transactions": [], + }, + { + "filename": "ipo-anthropic-created.json", + "event_type": None, + "title": "Anthropic", + "isin": None, + "shares": None, + "value": None, + "transactions": [], + }, { "filename": "junior_p2p_transfer.json", "event_type": PPEventType.REMOVAL,