Skip to content

fizban99/pp-portfolio-classifier

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pp-portfolio-classifier

Python script that automatically classifies Funds/ETFs managed in Portfolio Performance files by the stock types, countries and industry sectors they are invested in. Furthermore it determines the Top 10 holdings of each fund. The classifier uses the information from morningstar as a data source for classification. It first tries to retrieve the information of the security from Morningstar itself and, if not found, it tries to use the x-ray service. Based on the script by fbuchinger

Warnings & Known Issues

Installation

requires Python 3, git and Portfolio Performance. Steps:

  1. git clone this repository
  2. in the install directory run pip3 install -r requirements.txt
  3. test the script by running python portfolio-classifier.py test/multifaktortest.xml to test the script. Then open the resulting file pp_classified.xml in Portfolio Performance.

How it works:

Important: Never try this script on your original Portfolio Performance files -> risk of data loss. Always make a copy first that is safe to play around with or create a dummy portfolio like in test folder.

  1. In Portfolio Performance, save a copy of your portfolio file as unencrypted xml. The script won't work with any other format.
  2. The secid is the value of the attribute is the code at the end of the morningstar url of the security (the id of length 10 after the "?id=", something like 0P00012345). The script will try to get it from the morningstar website, but the script might have to be configured with the domain of your country, since not all securities area available in all countries. The domain is only important for the translation from isin to secid. Once the secid is obtained, the morningstar APIs are country-independent. The script caches the mapping between the isin and the secid plus the security id type and the domain of the security into a file called isin2secid.json in order to reduce the number of requests.
  3. Run the script python portfolio-classifier.py <input_file> [<output_file>] [-d domain] If output file is not specified, a file called pp_classified.xml will be created. If domain is not specified, 'de' will be used for morningstar.de. This is only used to retrieve the corresponding internal Morningstar id (secid) for each isin.
  4. open pp_classified.xml (or the given output_file name) in Portfolio Performance and check out the additional classifications.

Gallery

Autoclassified stock-style

Autoclassified Security types

Autoclassified Regions

Autoclassified Regions

Autoclassified Sectors

Autoclassified Sectors

About

automatic classification of ETFs in Portfolio Performance using holding lists

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%