Skip to content

fix: replace compactPortfolio with compactPortfolioByType#362

Merged
RealCLanger merged 1 commit into
pytr-org:masterfrom
LoicSERRE:fix/compact-portfolio-by-type
Jun 22, 2026
Merged

fix: replace compactPortfolio with compactPortfolioByType#362
RealCLanger merged 1 commit into
pytr-org:masterfrom
LoicSERRE:fix/compact-portfolio-by-type

Conversation

@LoicSERRE

Copy link
Copy Markdown
Contributor

Trade Republic changed their WebSocket API in June 2026: subscriptions to "compactPortfolio" on web sessions (connect_id=31) now return:

BAD_SUBSCRIPTION_TYPE: Unknown topic type: compactPortfolio.31

The replacement endpoint is "compactPortfolioByType" which accepts the same optional secAccNo parameter. The response format changed: positions are now grouped in categories[].positions instead of a flat top-level positions array.

Additionally, the new format uses "isin" as the field name where the old endpoint used "instrumentId". The fix normalizes the field at reception so all downstream code in portfolio.py continues to work unchanged.

Fixes #361

Trade Republic changed their WebSocket API in June 2026: subscriptions to
"compactPortfolio" on web sessions (connect_id=31) now return:

  BAD_SUBSCRIPTION_TYPE: Unknown topic type: compactPortfolio.31

The replacement endpoint is "compactPortfolioByType" which accepts the same
optional secAccNo parameter. The response format changed: positions are now
grouped in categories[].positions instead of a flat top-level positions array.

Additionally, the new format uses "isin" as the field name where the old
endpoint used "instrumentId". The fix normalizes the field at reception so
all downstream code in portfolio.py continues to work unchanged.

Fixes pytr-org#361
@LoicSERRE LoicSERRE force-pushed the fix/compact-portfolio-by-type branch from 43ff29e to e6c6358 Compare June 21, 2026 23:37

@RealCLanger RealCLanger left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff. I thought I tried compactPortfolioByType myself but obviously not. Thanks for your contribution. 👍

@RealCLanger RealCLanger merged commit 74ca148 into pytr-org:master Jun 22, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pytr portfolio crashes with BAD_SUBSCRIPTION_TYPE

2 participants