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
1 change: 1 addition & 0 deletions pytr/alarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def overview(self):
writer.writerows(
[alarms_dict_from_alarms_row(key, value, max_values) for key, value in alarms_per_ISIN.items()]
)
self.fp.close()

def get(self):
cur_isin = None
Expand Down
10 changes: 8 additions & 2 deletions pytr/dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
"ORDER_REJECTED": "Trades",
"TRADE_CORRECTED": "Trades",
"TRADE_INVOICE": "Trades",
"TRADING_ORDER_CANCELLED": "Trades",
"TRADING_ORDER_CREATED": "Trades",
"private_markets_order_created": "Trades",
"trading_order_cancelled": "Trades",
"trading_order_created": "Trades",
Expand Down Expand Up @@ -241,8 +243,6 @@ def dl_callback(self, event):
if section["type"] != "documents":
continue

has_docs = True

subfolder = None
eventType = event.get("eventType", None)
title = event.get("title", "")
Expand Down Expand Up @@ -283,6 +283,12 @@ def dl_callback(self, event):
self.log.warning(f"no subfolder mapping for {eventdesc}")

for doc in section["data"]:
if isinstance(doc["action"]["payload"], dict):
self.log.warning(
f'Download of document with new API-Path URL "{doc["action"]["payload"]["path"]}" is not possible. (yet?)'
)
continue
has_docs = True
timestamp_str = event["timestamp"]
if timestamp_str[-3] != ":":
timestamp_str = timestamp_str[:-2] + ":" + timestamp_str[-2:]
Expand Down
12 changes: 9 additions & 3 deletions pytr/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ def from_dict(cls, event_dict: Dict[Any, Any]):
Returns:
Event: Event object
"""
date: datetime = datetime.fromisoformat(event_dict["timestamp"][:19])
ts = event_dict["timestamp"]
ts = ts[:-2] + ":" + ts[-2:]
date: datetime = datetime.fromisoformat(ts)
title: str = event_dict["title"]
isin2: Optional[str] = None
subtitle = event_dict["subtitle"]
Expand Down Expand Up @@ -373,9 +375,12 @@ def from_dict(cls, event_dict: Dict[Any, Any]):
for item in uebersicht_dict.get("data", []):
if item.get("title") == "Event" and item.get("detail", {}).get("text", "") == "Bonusaktien":
event_type = PPEventType.TAXES
if event_type is PPEventType.SPINOFF and subtitle == "Spin-off" and uebersicht_dict:
if event_type is PPEventType.SPINOFF and subtitle in ["Aktiendividende", "Spin-off"] and uebersicht_dict:
for item in uebersicht_dict.get("data", []):
if item.get("title") == "Event" and item.get("detail", {}).get("text", "") == "Spin-off":
if item.get("title") == "Event" and item.get("detail", {}).get("text", "") in [
"Aktiendividende",
"Spin-off",
]:
event_type = PPEventType.TAXES

ignoreEvent = False
Expand Down Expand Up @@ -681,6 +686,7 @@ def _parse_shares_value_fees_taxes_note(
and title not in ["Aktien-Bonus"]
and subtitle
not in [
"Aktiendividende",
"Aktiensplit",
"Aufruf von Zwischenpapieren",
"Bonusaktien",
Expand Down
6 changes: 5 additions & 1 deletion pytr/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ def from_event(self, event: Event) -> Iterable[dict[str, Any]]:
return

kwargs: _SimpleTransaction = {
"date": event.date.isoformat() if self.date_with_time else event.date.date().isoformat(),
"date": event.date.replace(microsecond=0, tzinfo=None).isoformat()
if self.date_with_time
else event.date.date().isoformat(),
"type": self._translate(event.event_type.value) if isinstance(event.event_type, PPEventType) else None,
"value": self._decimal_format(event.value),
"note": self._translate(event.note) + " - " + event.title if event.note is not None else event.title,
Expand Down Expand Up @@ -166,6 +168,8 @@ def from_event(self, event: Event) -> Iterable[dict[str, Any]]:
kwargs["isin"] = "CNE100000296"
elif event.note == "Chipotle":
kwargs["isin"] = "US1696561059"
elif event.note == "VERSANT MEDIA GRP A O.N.":
kwargs["isin"] = "US9252831030"
elif event.note == "Eckert & Ziegler":
kwargs["isin"] = "DE0005659700"
elif event.note == "Enovix Corp. WTS 01.10.26":
Expand Down
136 changes: 136 additions & 0 deletions tests/aktiendividende_only_taxes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"id": "09fffef5-6022-32a6-a5b5-55fcd880cad6",
"timestamp": "2026-01-06T16:14:51.218+0000",
"title": "Enovix Corp. WTS 01.10.26",
"icon": "logos/US2935941078/v2",
"avatar": {
"asset": "logos/US2935941078/v2",
"badge": null
},
"badge": null,
"subtitle": "Aktiendividende",
"amount": {
"currency": "EUR",
"value": -0.57,
"fractionDigits": 2
},
"subAmount": null,
"status": "EXECUTED",
"action": {
"type": "timelineDetail",
"payload": "09fffef5-6022-32a6-a5b5-55fcd880cad6"
},
"cashAccountNumber": "123456789",
"hidden": false,
"deleted": false,
"source": "timelineTransaction",
"details": {
"id": "09fffef5-6022-32a6-a5b5-55fcd880cad6",
"sections": [
{
"title": "Du hast -0,57 € bezahlt",
"data": {
"icon": {
"asset": "logos/US2935941318/v2",
"badge": null
},
"timestamp": "2026-01-06T16:14:51.218Z",
"status": "executed"
},
"type": "header"
},
{
"title": "Übersicht",
"data": [
{
"title": "Status",
"detail": {
"text": "Ausgeführt",
"functionalStyle": "EXECUTED",
"type": "status"
},
"style": "plain"
},
{
"title": "Event",
"detail": {
"text": "Aktiendividende",
"displayValue": {
"text": "Aktiendividende"
},
"type": "text"
},
"style": "plain"
},
{
"title": "Wertpapier",
"detail": {
"text": "Enovix Corp. WTS 01.10.26",
"displayValue": {
"text": "Enovix Corp. WTS 01.10.26"
},
"type": "text"
},
"style": "plain"
}
],
"type": "table"
},
{
"title": "Geschäft",
"data": [
{
"title": "Bruttoertrag",
"detail": {
"text": "0,00 €",
"displayValue": {
"text": "0,00 €"
},
"type": "text"
},
"style": "plain"
},
{
"title": "Steuer",
"detail": {
"text": "-0,57 €",
"displayValue": {
"text": "-0,57 €"
},
"type": "text"
},
"style": "plain"
},
{
"title": "Gesamt",
"detail": {
"text": "-0,57 €",
"displayValue": {
"text": "-0,57 €"
},
"type": "text"
},
"style": "plain"
}
],
"type": "table"
},
{
"title": "Dokumente",
"data": [
{
"title": "Dokumente",
"detail": "06.01.2026",
"action": {
"payload": "",
"type": "browserModal"
},
"id": "6406bb21-18b9-41d6-9ec8-cecd3babbd82",
"postboxType": "CA_INCOME_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 @@ -130,6 +130,24 @@ def test_events():
}
],
},
{
"filename": "aktiendividende_only_taxes.json",
"event_type": PPEventType.TAXES,
"title": "Enovix Corp. WTS 01.10.26",
"isin": "US2935941318",
"value": -0.57,
"taxes": -0.57,
"transactions": [
{
"Datum": "2026-01-06T16:14:51",
"Typ": "Steuern",
"Wert": -0.57,
"Notiz": "Enovix Corp. WTS 01.10.26",
"ISIN": "US2935941318",
"Steuern": 0.57,
}
],
},
{
"filename": "aktienpraemiendividende.json",
"event_type": PPEventType.DIVIDEND,
Expand Down
Loading