This project implements a neural network strategy for trading based on the research paper titled 'A Stock Market Trading System using Deep Neural Network' by Bang Xiang Yong, Mohd Rozaini Abdul Rahim, and Ahmad Shahidan Abdullah. You can access the paper here.
You can view the detailed write-up about the code here.
The Python implementation resides in the neural_network_trading_algo
directory. To run the project:
- Navigate to the
main.py
file in your terminal. - Execute the file to perform:
- Data gathering
- Preprocessing
- Model training
- Model saving
- Model evaluation
- Signal generation
- Backtesting the strategy on generated signals
To install the required packages and dependencies, follow these steps:
-
Clone the Repository:
git clone https://github.com/Joshbazz/Neural_Network_Trading_Algo.git cd Neural_Network_Trading_Algo
-
Install Make with Conda if not Already Installed (optional but recommended)
conda install -c conda-forge make
-
Create a Virtual Environment with Make (optional but recommended)
make create_environment
-
Activate the Environment before Downloading Requirements
conda activate neural_network_trading_algo
-
Install Dependencies
make requirements
NOTE:
Due to issues with graphviz, in main.py
, the (save_and_visualize_model(model_path)
) is commented out. If you successfully get graphviz installed, you can uncomment.
You'll need to locally install Graphviz and/or Make in order to run the make
commands and create the model visualization. To download Make for Windows, open up Powershell and run: winget install ezwinports.make
There's an issue where using graphviz on VScode run from the Anaconda Platform is creating issues. Make sure you are running VScode explicitly from your own separate download. VScode can be downloaded here
Links for downloading Make (Windows) are here, and downloads for Graphviz are included here.
If you prefer running the code without downloading the repository or if you're a non-technical user, you can run the project directly in Google Colab. Click the badge below to open the notebook in your browser:
Simply navigate to the top bar, and under Runtime, click on "Run All" (see below):
Note: Initial downloads may be required when running in Colab.