This project demonstrates a simple trading advice pipeline that takes into account 30 day forward forecasts of company share prices and by extension, when certain simple moving average (SMA) indicator cross over. Potential buy and sell signals are collated for all companies and then emailed to a given address with information on:
- stock name
- when key indicators are forecast to cross
- Buy signal: when SMA_50 positively crosses SMA_200
- Short signal: when SMA_10 negatively crosses SMA_50
-
Setup local database
- example uses MYSQL with a named database called
stocks
- [TODO] add integration to GCP
- example uses MYSQL with a named database called
-
Setup API key with AMERITRADE
- needed to get access to all tickers on NYSE
- go to https://www.tdameritrade.com/home.html
- open free account to get api token
- [TODO] find data source api to LSE
-
Fill on config
- rename
config.json.dist
toconfig.json
inconfig/
folder - fill in missing details
- rename
-
Pull and save historical share price data
- run
python3 main.py -b
- run
-
Forecast for signals
- run
python3 main.py -f
- will persist buy and sell signals to file in
data/
- run
-
Email signals
- run
python3 main -e
- will email signals
- run
-
Persist signals
- run
python3 main -p
- persist buy/sell signals to table
recommendations
- run
- Setup airflow locally
- there are numerous websites to help setup airflow
- currently this has been done on mac
- once setup, copy
trading_bot_dag.py
intodags/
folder - change project paths for
PROJECT_DIR
andPYTHON_ENV
- run dag
Note:
- PROJECT_DIR is the local directory that this project is located
- PYTHON_ENV is the python path for the virtual environment of this project
This is my personal project aimed purely as a hobby to practice coding and to learn more about the stock market.
I take no responsibility for anyone's trading activities based off the recommendations from this work.