pytr: BAD_SUBSCRIPTION_TYPE error for pytr portfolio
Description of the bug
I tried to read out my portfolio with pytr portfolio, but got a BAD_SUBSCRIPTION_TYPE error response
To Reproduce
- Successfully logged in
- Ran the command
pytr portfolio - See error
Expected behavior See my current portfolio
Error log
21:49:12 Found credentials file
21:49:12 Phone: +49176********, PIN: ****
21:49:12 Web session resumed
21:49:12 Logged in
21:49:12 Connecting to websocket ...
21:49:12 Connected to websocket ...
21:49:13 Received error message: '1 E {"errors":[{"errorCode":"BAD_SUBSCRIPTION_TYPE","errorField":null,"errorMessage":"Unknown topic type","meta":{"source":"MAPPER"}}]}'
Traceback (most recent call last):
File "/home/martin/.local/bin/pytr", line 8, in <module>
sys.exit(main())
File "/home/martin/.local/lib/python3.10/site-packages/pytr/main.py", line 215, in main
Portfolio(login(phone_no=args.phone_no, pin=args.pin, web=not args.applogin)).get()
File "/home/martin/.local/lib/python3.10/site-packages/pytr/portfolio.py", line 73, in get
asyncio.get_event_loop().run_until_complete(self.portfolio_loop())
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/martin/.local/lib/python3.10/site-packages/pytr/portfolio.py", line 16, in portfolio_loop
_subscription_id, subscription, response = await self.tr.recv()
File "/home/martin/.local/lib/python3.10/site-packages/pytr/api.py", line 352, in recv
raise TradeRepublicError(subscription_id, subscription, payload)
pytr.api.TradeRepublicError: ('1', {'type': 'portfolio'}, {'errors': [{'errorCode': 'BAD_SUBSCRIPTION_TYPE', 'errorField': None, 'errorMessage': 'Unknown topic type', 'meta': {'source': 'MAPPER'}}]})
Environment
- OS: Linux
- pytr version: 0.1.5
Additional context It was still working a couple of week ago. Other commands still work. Did they change the API?
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 17 (8 by maintainers)
Short update: I went into the rabbit hole to learn how to monitor websocket traffic - quite fun actually - and learned there is a new subscription command
compactPortfolio, which returns a reduced json with only three entries:{"positions":[{"instrumentId":"","netSize":"","averageBuyIn":""}]}But that won’t help with the old implementation, as a live update on the current net value is not provided.