If you would use a stock course API being more general it might enhance the number of people interested in using your custom component. It has more functionality, than the Alpha Vantage component. I like the option to enter the number of stocks and to calculate the total capital (and the automation you described in github (which I haven’t tried right now, because my stocks do not work)…
Yep, I know. BUT: That’s only the price in US$, but I buy those in €uro; therefore the calculated values do not reflect my stocks
Done some work using this component today. Works great once I had all the stock id numbers correctly (only tried Swedish Market and found the ids quite easily after searching on avanza.se). Thank you so much for it.
I have a question on how often the values are updated? Can I set that myself somehow?
Yeah it takes some time to find all the ids. I will try and see if I can loop through all ids and make a list and upload it to github, then we could just search that list.
They are updated once an hour, if you are interested in the code you can search for SCAN_INTERVAL. You can change it yourself to 60s or whatever you like
Nice. Every hour is good enough for me, but it’s nice to know it could be changed. Also thanks for the advice on the update_entity, hadn’t thought about that.
Also, as regards getting all the ids, maybe a webscraping effort of https://www.avanza.se/aktier/lista.html and the following could make that list happen? I haven’t tried yet, just had a look on the avanza site to find somewhere with all or most available ids…
I looped through all id between 0 and 1000000 and came up with this list. Over 50000 items, not all of them are stocks. Should be easy enough to find what you are looking for.
Big fan of this custom component, great work! However, I got tired of copying stock id, names, shares etc for every stock I want to put in a sensor, so instead I created a custom Tampermonkey script that generates the config for me! If you want to check it out, I made it available here: https://github.com/Miicroo/TamperMonkey/tree/master/avanza.
How it works: you navigate to an avanza page and the script scrapes the data from the page and adds a link to a modal popup. If you click the link it shows the configuration together with a button to copy the contents. You can also change which monitored_conditions that you want to use.
Best feature yet: If you are logged in it will parse the number of shares that you own
That is a feature of Home Assistant, the bonus HACS gives is that if you use that to initially “install” the integration, you do not have to restart HA before you can configure it.
It would be possible, but I think that you might want to just write a custom python script for that. The only feature of having my tampermonkey script is that you get the data directly from the avanza stock webpage that you are on. If you already have the exported csv you already have that data somewhere else, so I guess that it is just a matter of formatting it from csv to yaml.
On the other hand, it would be fun to create a new script that you can trigger from for instance your profile which creates a configuration out of all of your owned stocks.
My python_script that sends a summary of upcoming dividend payouts, The reason I decided to use python_script is that it makes it really easy to sort the data.