This web-scraping tool aims to extract portfolio asset information (such as stocks, cryptos and ETFs) from Scalable Capital and Trade Republic, given that both neobrokers currently do not feature a portfolio value export. The main features are:
- Import of portfolio asset of both Scalable Capital and Trade Republic, incl. assets name, ISINs and assets current value.
- Semi-automatic login option, where login and password are automatically filled if user adds the parameters
login
andpassword
. It waits until 2FA login confirmation. - Save of the imported assets as an Excel, .csv or a simply copy it as a table to the system clipboard.
The code runs locally in the user's machine and imitates, via Chrome WebDriver and the Selenium library, user's behavior and extracts the assets information from Scalable Capital and Trade Republic. No information is collected and send externally.
For security reason, it is recommended to keep the default parameters login = None
and password = None
.
python -m pip install lxml openpyxl pandas selenium webdriver-manager xlsxwriter
scalable_capital_portfolio_import(login=None, password=None, file_type='.xlsx', output_path=os.path.join(os.path.expanduser('~'), 'Downloads', 'Assets Scalable Capital.xlsx'))
trade_republic_portfolio_import(login=None, password=None, file_type='.xlsx', output_path=os.path.join(os.path.expanduser('~'), 'Downloads', 'Assets Trade Republic.xlsx'))
- Scraps and imports portfolio asset information from Scalable Capital and Trade Republic.
- The selected language must be set to
English
for both Scalable Republic and Trade Republic.
login
: str, default: None. If defined (e.g.login = '[email protected]'
), login information is automatically filled; otherwise, user needs to manually add them once the WebDriver initiates.password
: str, default: None. If defined (e.g.password = '12345'
), password information is automatically filled; otherwise, user needs to manually add them once the WebDriver initiates.file_type
: str, options: '.xlsx', '.csv' and None, default: '.xlsx'. If None, imported assets dataset is copied to the system clipboard.output_path
: path object, default: None. If None, imported assets dataset is copied to the system clipboard.return_df
: bool, default: False. Returns DataFrame from function.
selenium_webdriver_quit()
- Terminates the WebDriver session.
- None.
# Scrap, import and save as .csv portfolio asset information from Scalable Capital
scalable_capital_portfolio_import(
login=None,
password=None,
file_type='.xlsx',
output_path=os.path.join(
os.path.expanduser('~'),
'Downloads',
'Assets Scalable Capital.xlsx',
),
return_df=False,
)
# Scrap, import and save as .csv portfolio asset information from Trade Republic
trade_republic_portfolio_import(
login=None,
password=None,
file_type='.xlsx',
output_path=os.path.join(
os.path.expanduser('~'),
'Downloads',
'Assets Trade Republic.xlsx',
),
return_df=False,
)
# Quit WebDriver
if 'driver' in vars():
driver.quit()
pytr: Use Trade Republic in terminal.