Stock investment analysis app made with Raspberry Pi

1. Motivation

The basis of stock investment is that if you buy when it is cheap and it becomes expensive, you will get a selling profit. I think individual investors are always watching dozens of stocks (hundreds of stocks depending on the person), but what is the current state of each stock (that is, downtrend, uptrend, frustration)? It's hard to look at the charts one by one every day.

Therefore, if you analyze the chart of individual stocks using a machine instead of humans and let the trend of the stock be automatically judged every day, it will save time, and you can use the spare time for fundamental analysis of the overall market price. If so, I think we can carry out more strategic investment activities.

In other words, I decided to design an app that I will introduce for the purpose of automating the analysis of individual stocks.

★ Created app 42.gif

2. Why did you choose Raspberry Pi?

I think that the hardware that mounts this app should have the following features.

-Can be operated at all times. ・ When the time comes, let the fixed processing be performed. -Can be used as a Web server. (It's easy to have a Linux-based OS on board) ・ Has some computing power.

The Raspberry Pi is famous as the hardware that has the above. As of March 2020 Raspberry Pi 4 has specifications of CPU (ARM Cortex-A72 quad core 1.5GHz) and memory 4GB (LPDDR4 SDRAM), which can be said to be sufficient specifications to perform desired processing.

The figure below is a network configuration diagram. It is assumed that Raspberry Pi 4 will be set up at home. Raspberry Pi 4 is responsible for stock price data acquisition, technical analysis, web server, and data display </ b>.

Windows PCs and smartphones are client devices, and are responsible for displaying stock price data, charts, technical analysis results, etc., and issuing instructions such as stock registration and stock price acquisition.

If you put a client terminal such as a smartphone or PC and a Raspberry Pi on the same VPN, you can go out You can access the Raspberry Pi.

41.JPG

3 system configuration

I decided to build this system in a container on Docker because I want to easily transfer it to another Raspberry Pi.

42.JPG

4. Introduction of the app

Introducing the implemented functions.

4-1 You can register the brand.

You can register the brand you want to watch. You can also register profits per share, dividends, settlement dates, company profile, etc. If you write a scraping code (obtain the necessary information from another site and write it automatically) separately with Jupyter etc., you can streamline the brand registration work. Even when registering multiple stocks, the above scraping code can be used to automate the input work. For example, here has detailed instructions on how to create scraping code, so please have a look if you are interested.

The input is automated by scraping code </ b> 36.gif

4-2 Various indicators can be displayed.

You can display various indicators of the day (Nikkei 225, US 10-year interest rate, ...). It is automatically acquired from an external site using scraping technology.

36.JPG

4-3 You can manage stocks.

Registered stock data is displayed in a list. For registered stocks, today's stock price, closing date, dividend yield, and technical analysis result summary (Bollinger, Ichimoku Kinko Hyo) are displayed.

35.JPG

4-4 You can see the company profile.

Click the overview button to view the company profile. If you have multiple candidate stocks, you will not be able to remember which stock is doing what business. In such a case, it is convenient because you can check the company profile.

37.gif

4-5 You can see the stock price information of each brand at a glance.

You can see today's stock price, closing date, dividend yield, and technical analysis result (for Bollinger and Ichimoku Kinko Hyo) summary of each registered stock.

37.JPG

4-6 You can see the technical analysis summary of each brand.

You can see at a glance which Bollinger Bands the current stock price is in without actually looking at the Bollinger Bands graph. In other words, since it is a list, you can see at a glance which stocks are on an upward trend and which stocks are on a downward trend.

38.JPG

4-7 You can see the status of each brand in the list.

If you have multiple watch stocks, it is difficult to check the chart one by one to see which stock is cheaper. By looking at the Ichimoku Kinko Hyo, you can determine whether the current stock price is the beginning or end of the uptrend, or the beginning or end of the downtrend. (The explanation of the Ichimoku Kinko Hyo is in the article here.)

There are symbols such as [A2] and [A5] in the "Ichimoku Kinko Hyo" column of the stock list below, which indicates the beginning or end of the uptrend or downtrend. If you can identify the stock at the beginning of the uptrend among dozens or hundreds of stocks just by looking at the list, you can reduce the possibility of missing a buy time and at the same time check the chart for each stock. It also saves time and effort, reducing the time required for routine analysis performed by humans.

40.JPG

Recommended Posts