Great. Thanks for the hint. Yes, this satisfies my use case.
Hi,
i get this message when i run the test skript:
WARNING: MORNINGSTAR API HAS CHANGED.
THIS VERSION OF THE SCRIPT WILL PROBABALY NOT WORK ANYMMORE.
Please try new-api-branch instead.
what am I doing wrong?
Skip reading the error message. It includes the way to go:
But How? Is there an German Version anywhere?
Not that I am aware of. Here is a manual how you install ist. But I am not a GitHub expert, if it overwrite the old version or not.
Here is the post which contains the direct link:
(Otherwise, you can choose the new-API-branch with “Switch branches/tags” in github. There is a button at the top of the page which usually shows “main” and when you click it, you can change the branch).
It seems that the old Morningstar API has gone forever. Therefore, I plan to merge the new-API-branch back to the main branch when I find the time to properly update the README.
Thank you very much.
I’m one step further.
Now im getting this error:
portfolio-classifier.py: error: unrecognized arguments: [-d domain] [-stocks]
Can some one please give me an excample how the right command should look like?
Hi,
python portfolio-classifier.py -h gives you the help text.
Arguments in square brackets are optional, i.e. you don’t have to use them.
( “[“ and “]” don’t belong into the command line).
Assuming you have an xml file called MyPortfolio.xml in the same directory, then you could use:
python portfolio-classifier.py MyPortfolio.xml
This will classify all your equity funds and ETFs. The result will be in pp_classified.xml.
If you want to modify your file directly you may use:
python portfolio-classifier.py MyPortfolio.xml MyPortfolio.xml
If you also have individual stocks and you want to classify them as well, use:
python portfolio-classifier.py MyPortfolio.xml MyPortfolio.xml -stocks
By default, the script fetches the top ten positions of each fund/ETF. If you want the top 50, try:
python portfolio-classifier.py MyPortfolio.xml MyPortfolio.xml -top_holdings 50
Hope that helps and gives the idea also for the other options.
Now its working!
Absolutely Amazing! Thank you
Hi,
I tried to update the classification. It worked end of August, but now I don’t get the classifications. I’m on the new-api branch.
same error message for each stock:
@ Retrieving data for fund DE0009769869 (F0GBR04CNE) …
[DWS Aktien Strategie Deutschland LC]
Warning: Problem with Asset-Type for secid F0GBR04CNE in PortfolioSAL…
Warning: Problem with Stock-style for secid F0GBR04CNE in PortfolioSAL…
Warning: Problem with Sector for secid F0GBR04CNE in PortfolioSAL…
Warning: Problem with Holding for secid F0GBR04CNE in PortfolioSAL…
Warning: Problem with Region for secid F0GBR04CNE in PortfolioSAL…
Warning: Problem with Country for secid F0GBR04CNE in PortfolioSAL…
Any idea?
Try deleting the file cache.sqlite. Sometimes this helps. (Otherwise, try several times or later.)
@tommi296 I just realised that you are still using “old” version with “PortfolioSAL”. Try latest version of new-api-branch. (Or maybe you are even using main branch).
thanks! I was indeed on the main branch.
the reason is, the link in the “<> Code” drop down menue on git-hub for the new-api-brach seams to be the same as for the main branch. Downloading the ZIP file solves the issue.
Hallo Andreas,
I found some time to work again on the JSON-Import for the classifications. I am in the testing phase. The generating of specific JSON-Files for sector, region, country and holding data works well. But I am struggling with the options in your Import menu:
”the delete categories and assignments” option is clear to me and does work with 1 exception:
it is not deleting sub-categories, eg Energie with sub-category 1.Oil 2.Gas in PP and in the JSON file the category is called ENERGY;
it creates an new Category ENERGY and deletes the old category Energie, but the new Category ENERGY will have the the 2 old sub-categories 1. Oil and 2. Gas. Is this the intention? I would like to have the complete new Classification structure of the data provider.
The one thing I cannot figure out, is the function of the “preserve existing names and description” option. what is the idea? What does it do?
best
Interesting. If you have "category key"s defined in your file and use the “key” attribute in the JSON file, then the category is matched by this key. And if you do not tick “preserve existing names and description”, then this matched category is renamed. If you do not want to use the keys, then do not put them into the JSON.
That would explain that the “Energie” category is found and then renamed to “ENERGY”.
However, it does not explain why “Oil” and “Gas” remain in the file even though you have checked the “delete categories and assignments not in the file”. I tested it and it was removing the sub categories.
Can you send me an example - XML and JSON for me to reproduce? portfolio dot performance dot help at gmail dot com
This is only relevant, if the categories are matched by “category key”. If it is matched by category key, you might not want to rename the label.
The idea: I want to be able to import a category with the key “ENERGY” but allow a German-speaking user to keep the label “Energie”. This way a tool could generate the weights, but users still can still update their localized taxonomy (of course, new categories would be in English, but existing ones are not touched).
@Alfons1Qvor12
I got as well some issues with the classification.
For test Purpose i got only one Fond in my example ISIN DE0008474149
But this does not work. So the question for me is, is the problem my installation of pp classifier or python or ???
Although i thought i got the new branch i still got the message that
WARNING: MORNINGSTAR API HAS CHANGED.
THIS VERSION OF THE SCRIPT WILL PROBABALY NOT WORK ANYMMORE.
Please try new-api-branch instead.
How can i check which branch i use?
So not sure what i did wrong .
The whole output on is the following (in the txt file
PP_classifier.txt (1,6 KB)
thanks for your help and the gorgeous Program overall
Hi @stb62et,
On github, there are two branches of the code, the so-called “main” branch and the so-called “new-api-branch”. You have installed the “main” branch, but you need to use the “new-api-branch”. On the github web interface, you find a “Switch branches/tags” field below “<> Code”.
The history behind this:
- The main branch was forked by me from fizban99’s version.
- I enhanced the functionality related to xml files but I did not change the fundamental mechanisms for retrieval of data from Morningstar.
- Later, I also wanted to improve the retrieval of data and did not find sufficient documentation of the used Morningstar API. However, I found official Morningstar documentation about another API.
- Therefore, I created a second branch (“new-api-branch”) which uses that well documented API of Morningstar. I developed various functionality on the new API. Some is better (e.g. it retrieves more holdings per ETF and has a function to calculate German “Vorabpauschale”), but some is also worse (it does not “know” as many individual shares as the originally used API). This branch is in a good shape, but still work in progress. In particular, it does not have a good README section yet.
- Earlier this year, Morningstar changed their web services and it seems that the originally used API does not work anymore. (I was not sure, if this was temporary or not, but now it is quite obvious that it is not).
- So currently, all the previous versions of this script don’t work anymore, including my version on the “main” branch. The only functioning version is my “new-api-branch”, but it is not fully documented yet.
- My plan is to complete work on the “new-api-branch” and to merge it back to the main branch so that there will be only one functioning branch. However, I currently don’t find the time for this. I hope that in the next few months I will.
Thanks for your awesome work!
I’m not sure whether the script will be integrated directly into the application, nor what the practical benefit is of being able to export and import the classification within PP. Could you clarify?
Hi @Fabio85,
The first versions of the script are much older than the PP export and import of classifications in JSON. It modifies directly the xml files of PP. It is a bit cumbersome, if you have a portfolio in binary. In such case you need to store the portfolio first in xml, then close PP and run the script, and afterwards open PP again and store the portfolio as binary again.
With the new export and import function for classifications in JSON provided by Andreas recently, this could be potentially improved. A new version of the script could work directly on a JSON file and you as a user would only need to import an updated version into your binary portfolio to update all classifications.
I don’t have plans to create such a new version of the script and for some of the features (like #PPC:SKIP and #PPC:ISIN2) the porting might be a bit tricky, but in principle the new export and import function for classifications in JSON opens the possibility for such kind of integration.
I would not go for any further integration. The whole concept of the script could collapse any time, if Morningstar modifies something on their servers and I am not sure, if I or some else would always be able to adapt the script to such changes.
