The goal of this project is to get your Trading212 portfolio, calculate your returns and show everything clearly without having to log in to the Trading 212 website. This is achieved by getting the order information from a provided csv and searching in yahoo finance for the current prices of the stocks. This is a more interactive version of my Trading212Portfolio.
When you hover over a slice of the donut chart it shows you the stock ticker, the current value of this investment and the percentage of your portfolio it occupies. Click on any any ticker in the legend under the chart to remove it or add it back in the chart.
This project is designed for accounts with EURO currency. It converts Usd, GBp, and Nok to euro. If you want to change it to your currency or add more conversions follow the instructions here
- Run the command
npx create-electron-app trading212_desktop_app
to create the skeleton of an electon app using electron forge. - Delete the package.json file and src folder in your install location and replace them with my own files.
(Alternatively you can keep your package.json if you change
"main": "src/index.js"
to"main": "src/main.js"
) - Go to src\python (inside your install location) and replace my orders.csv with your own. (Don't forget to name it the same).
Instructions on how to download your order data from Trading 212 here. Select ONLY the orders as included data.
- Open
src\python\myPortfolio.py
and run it in order to make a local server - Open a terminal and cd to your install location. Run the command
npm start
- Open a terminal and cd to your install location. Run the command
npm run make
- Go to the yahooInfo function of
src\python\stockAndCurrencyData.py
and locate where we get the currency rates
- Here you can add more currency conversions. For example to get the conversion rate from Swedish Krona to Euro add
sekEuroRate = c.getRate('SEK', 'EUR')
- If you want to change the currency from Euro to your currency (for example Usd) you need to change the commands like this:
euroUsdRate = c.getRate('EUR', 'USD')
gbpUsdRate = c.getRate('GBP', 'USD')
nokUsdRate = c.getRate('NOK', 'USD')
- Locate where we convert everything to euros
- To add your currency conversion add another elif statement after the last one. For example to use the
sekEuroRate
which we created in the above example you need to add
elif currency == "SEK": curPrice = sekEurRate*curPrice
(use the correct python spacing)
- To change the currency from Euro to your currency (for example Usd) you need to change the commands like this:
if currency == "EUR": curPrice = eurUsdRate*curPrice elif currency == "GBp": curPrice = gbpUsdRate*curPrice*0.01 elif currency == "NOK": curPrice = nokUsdRate*curPrice
(use the correct python spacing)