STITAP stock screener is a free, open-source program which screens all 30 companies of the Straits Times Index using common technical indicators.
It uses a python interface to retrieve data from Alpha Vantage, which provides a free API for both historical and real-time financial data.
Get your free API key here.
For a gentle introduction to STITAP and its functionalities, you can refer to this article.
Simply put, STITAP pulls data from AlphaVantage through its API before performing calculations and storing the results in csv files. The program is run using the python shell.
If you do not already have Python IDLE installed, you can get it here.
Install Pandas and Numpy, or just download Anaconda.
Clone the repository by clicking the green button on the top right corner of the page.
Go to the folder STI_Stock_Screener -> alpha_vantage. Run the file run.py.
Get your free AlphaVantage API key here.
In run.py, set the key argument to your API key value in the Initializer class:
class Initializer(ABC):
"""Abstract base class for initializing the program
"""
def __init__(self, timeframe="daily"):
"""Initializes the class by creating a new TimeSeries object
Keyword Arguments:
timeframe: timeframe for backtest. Supported values are "daily", "weekly" and "monthly" (default "daily")
"""
self._ts = TimeSeries(key="", output_format="pandas") # <--- SET API KEY HERE
self._timeframe = timeframe
Run run.py. Enjoy!
Do note that AlphaVantage limits the frequency of API calls
You can adjust the frequency of API calls in the _loop() method in the Initializer class:
def _loop(self):
"""Loops over each stock, using the _fetch_store() method to fetch and store each stock's data
"""
for stock_name, stock_ticker in sti_stocks.items():
time.sleep(0.1)
print (f"LOADING: {stock_name} {stock_ticker}", end="\n"*2)
stock_name_no_spaces = stock_name.replace(" ", "_")
time.sleep(60) # <--- Adjust the duration (No. of seconds) of waiting time between each API call here
self._fetch_store(stock_name_no_spaces, stock_ticker, self._timeframe)
- Top 5 stocks with highest/lowest price/volume change
- Moving Average Convergence / Divergence (MACD)
- Relative Strength Index (RSI)
- Stochastic Relative Strength Index (StochRSI)
You can refer to examples here.
Contributions are always welcome.
If you can find a way to improve this project, do send a pull request.
-
My program crashed shortly after running run.py. How do I fix this?
- The program may have exceeded the API call frequency limit. You can either restart the program after waiting a few minutes or adjust the frequency of API calls (please refer to the "adjust API call frequency" section).
-
The technical indicator values are not exactly accurate. Why?
- The timeframes used in the program are estimated and do not take into account public holidays. We will fix this in future updates. (This has been fixed in V1.1.0)
You can get in touch with me through my website.
- Improve accuracy of technical indicators (Done)
- Reduce code repetition (First round of refactoring completed - V1.2.0)
- Add more technical indicators
- Set up a database and server (Ongoing)
- Introduce backtesting (Ongoing)
If you enjoyed using this, do show your support by starring it!