Build your own technical analysis stock screener using Python
An example based on the Malaysian stock market.
There are dozens of amazing stock screener apps and sites out there like TradingView. However, most sites do not offer as much customization as you want, if you don’t pay for it.
The good news is, with a few lines of Python code, you can make your own customized simple stock screener, and I am here to show you how.
If you haven’t set up Python on your computer yet, click here for the setup tutorial. If you’re totally new to Python I strongly recommend using Jupyter Notebook or Google Colab to get you started.
Step 1: Get stock prices
First things first, we need stock prices. There are, again, many great free APIs out there that allow you to access the stock prices using literally two lines of code.
import yfinance as yf
yf.Ticker("AAPL").history(start="2021-01-11", end="2021-01-15")
However, for those who have tried to do the same to the stocks listed in Bursa Malaysia (stock exchange of Malaysia), you might have come across something like this.
Fortunately, it’s not the end of the world. We can always try to scrape the stock data from some other stock websites. I am using i3investor in this example.