pytr
pytr copied to clipboard
Fix portfolio mode by adding secAccNo parameter to compactPortfolio
Fixes #246
Description
The Trade Republic API now requires the secAccNo (securities account number) parameter for the compactPortfolio subscription. This PR fixes the issue where portfolio mode was not returning any positions.
Changes
- Added
secAccNoattribute toTradeRepublicApiclass - Enhanced
settings()method to extractsecAccNofrom the settings response (checks forsecuritiesAccountNumberfield) - Updated
compact_portfolio()method to includesecAccNoin the subscription request - Also added
compact_portfolio_by_type()method for completeness (as mentioned in the issue)
Testing
- Tested with web login session
- Successfully retrieves portfolio positions after fix
- Extracts
securitiesAccountNumberfrom/api/v2/auth/accountresponse
Related
Based on findings from @ganzinotti in issue #246. The fix ensures that secAccNo is automatically extracted from the account settings and included in the subscription request.