Photo by Nick Page on Unsplash

Investing with pythons help | The execution

Maximilian Pollak

--

In the last story we explored the concept of this idea, trying to figure out what and how it should be done.

Now that it has been build it is time to show off, what it can do, so far. So here is the full look at the oddly named “DiviPy”.
If you want to try the app for yourself, I will link it on the bottom of the article.

The goal was not, to get a full portfolio recommended, but the goal was to get new inputs, and find hidden gems as well as get a rough overview and timeline.

So thats the landing page, it all is relatively self explanatory, but let me guide you through it.
We have a sidebar on the left, that has different filters and inputs on it. With these you can influence and tell the program what it should calculate. Let me go through them one by one

-Monthly investment goal:
This is the gross monthly amount that you want to have monthly. This is the target up to which the program will calculate.
-Max. percentage a stock can contribute towards the goal:
This is how much each stock can percentage-wise contribute to that goal you just set. So if your goal is 4000EUR, and you put 10% as max, then that means one stock can not go over 400EUR contribution to that monthly goal.
-Number of stocks:
Pretty self explanatory, you can choose any number of stocks between 1–100.
-Sectors:
Here you can pick all the sectors you want in the calculation. You can also just “select all”.
-Max. Nr. of stocks per sector:
Select how many stocks maximum, you want to have for each sector. There is a calculated minimum which is calculated so that your other inputs are valid (sectors with Nr. of stocks).
-Select your investment strategy:
This needs somewhat of an explanation. The three percentages you see here are the amounts of monthly investment each portion of stocks receives.
The first number = the top 25% of stocks
The second number = the middle 50% of stocks
The last number = the last 25% of stocks.
All of these are before categorised sorted by dividend yield.
You then just pick the one that suits you best, or that you want to try out.

Please note: This was just an arbitrary strategy, I did it because I wanted to be able to see how the numbers change based on putting more money into one than another stock.

-Monthly investment:
This is one of the most important ones. This is the amount that you will invest per month. The script will calculate monthly gained dividends on top of this amount and then use that as the new “investment money” for next month.
This also has a “minimum amount” which is calculated by the Nr of stocks, and your investment strategy so that the minimum amount a stock can receive is equal to 1EUR.

It is important to note that all numbers calculated are with a 100% reinvestment rate.

Once you have chosen and input all your filters, inputs and goals, the program should already have been running. If not please just click on search.
Then it should look somewhat like this:

As you can see it shows you all the selected features and goals on the top. As well as a breakdown of the end finances already. It shows you how long it would take to get to your goal (with 100% reinvestment of all dividends + your monthly investment), it shows you the average return or yield, how much you’ve contributed yourself and total investment.

Scroll a bit down and we are greeted with 4 different DataFrame options.
Stocks after 1,2,5 years and Stocks when the goal is reached.
Clicking on one of them, gives you the full DataFrame and all the information associated with it. Stock-name, how much you should buy, how much it contributes, the dividends it gets, etc.
p.s: If you click on the arrow in the top right it makes the DataFrame full screen, easier to read then.

As we can see here, it gives us a bit of overview information like invested money in the first year. If we make the DataFrame full screen we can see a broken down view of the information. This repeats for all of the DataFrames.

But let’s suppose we have studied this, and have come to the conclusion that some or maybe even all of these recommended stocks are not for us.
Luckily we can just filter them out and run the calculation again. All we have to do is to write the tickers which we do not want in the filter box like this:

And now, we can see that the tickers I have entered are no longer in the calculation, and have been replaced by other options. This also changed many other things like the years it takes to reach my goal, the yield, etc.

All in all this tool analyses in this fashion over 40k Stocks, from different countries around the world, including the US and Germany.

This is V1, now what is the plan for V2? Is there even a V2?
My plan now is to expand this by a lot, that’s why I’m planing on porting this over to a Django framework, and then expanding it there.
I want to include things like Portfolios, Watchlists etc…
I’m still quite early in this adventure and have lot’s to learn before that is ready to be presented, but I look forward to this challenge and will do my best.

Photo by David Iskander on Unsplash

I hope you enjoy what I have build, I certainly enjoyed the new learnings, frustration, and finally triumph that building this gave me.

If you want to try it for yourself you can do so:

DIVIPY — CLICK HERE TO GO TO THE STREAMLIT SHARED ONLINE VERSION

If you want to view the source code you can see that on my Github under the repository (Divipy-Streamlit)

Github-profile or go directly to the source Source-Code

Please let me know what you think of such projects, what could I have done better and what do you like.
And finally I hope I could inspire you to go and build something for yourself, something that you have a passion in and something that you want to use.

--

--

Maximilian Pollak
Maximilian Pollak

Written by Maximilian Pollak

A 27 year old aspiring Data Engineer with an interest for programming, investing, reading and science. I hope to learn lots here

No responses yet