As you have probably noticed, this repo is not maintained anymore.
For a worthy alternative, please have a look at degiro-connector
Very basic unofficial Python API for DeGiro. This API is only able to get details about your portfolio. It cannot be used for automatic trading. For a way more extensive Node.js API have a look at pladarias work.
Your password is stored plain text in a JSON file. Take adequate measures !, e.g. chmod
it to 600
. The API also won't work for users who have 2FA enabled.
from degiro import degiro
la = degiro()
la.login('config.json')
la.getConfig()
pfs = la.getPortfolioSummary()
portfolio = la.getPortfolio()
total = pfs['equity']
# Prints a pretty table of your equities and their allocation.
print('{:<20}\tsize\tvalue\tsubtot\t\talloc'.format('Product'))
for row in portfolio['PRODUCT'].values():
subtot = row['size']*row['price']
alloc = (subtot/total)*100 # Asset allocation (%)
print('{:<20}\t{:5.1f}\t{:6.2f}\t{:7.2f}\t\t{:2.1f}%'.format(row['name'], row['size'], row['price'], subtot, alloc))
print('Total: {:.2f}'.format(total))