This project makes use of my raspberry pi "server" sitting at home, to do real time monitoring of stock exchanges around the world.

  1. Monitor specific stocks, and according to a set of criteria (strategies) advise the right time to buy/sell a specific stock. Advices are sent via Telegram.
  2. Keep track of all movements (buy, sell, dividend, ...) of the stocks existing in a portfolio, and calculate total return of the investment. Receives commands to buy, sell, ... via Telegram.
  3. Test the investment strategies with historical data (aka "backtesting") to check the return of such strategies with past quotations

The project uses quotations from Google Finance, that allows real time quotation in many exchanges around the world. See current list of stock exchanges in this link

The project uses past quotations from Yahoo Finance for backtesting purposes.

The project includes a Telegram bot, that allows a user to interact with the raspberry pi, via exchanged messages. See example in attached photo.

For example, sending a message of "/returns" to the bot, will receive a reply with the current return of every stock in the portfolio.

The project accounts for different opening and closing times in markets worldwide.

It works with multiple time zones, and multiple currencies.

All data is stored in a local sqlite database.

Step 1: Prepare the Raspberry Pi

My particular setup is a Raspberry pi 3, with an external WD Pi Drive 314Gb disk. There is no need for the external disk though. The SD card should be enough, unless you have a few thousand stocks to monitor...

I will not show how to setup the raspberry pi to have it running normally.

I assume that you have already a running raspberry pi, with internet access.

Files for the project can be found in github here .Clone the files to your raspberry pi, issuing the command bellow, at the raspberry pi command line:

git clone https://github.com/kal001/stocks.git

You should have git installed in your raspberry pi for this to work. If it is not the case, install it first:

sudo apt-get install git-core

You should now have a "stocks" folder with all the files on it. List them with ls -la just to see if everything worked ok.

<p>This turned out looking great! Thanks for sharing your project! </p>

About This Instructable




More by Fernando Lourenco:transform raspberry pi into a stock exchange monitoring robot Raspberry Pi Temperature Logger via Radio 
Add instructable to: