Image by me using DALL·E 3

Using ResNet to Classify Stock Movements

Leveraging Deep Learning and Technical Analysis to Predict Stock Trends

Nayib
10 min readNov 6, 2023

--

In this article, I will explore how to leverage the power of ResNet, a type of convolutional neural network (CNN), to classify stock movements. I’ll walk you through a step-by-step process, beginning with obtaining historical stock data and adding technical indicators, and culminating in the creation of a small ResNet model that will try to predict stock trends.

All the libraries used are directly available in any Google Colab environment, except for 2 of them that have to be installed manually directly inside of Google Colab.

!pip install ta mplfinance

After ensuring that we installed those libraries, then we will have everything we need to do our imports.

import numpy as np
import tensorflow as tf
import keras
from keras import layers
import pandas as pd
import ta
import yfinance as yf
import mplfinance as mpf
import matplotlib.pyplot as plt
import concurrent.futures
import os
import cv2
from tensorflow.keras.utils import to_categorical

plt.ioff() # This is so matplotlib is not using the interactive mode

Let’s start our journey by diving into the first part of the code, which involves downloading the financial data.

--

--

Nayib

🔭 I am a aerospace systems engineering student with a passion for STEM. Feel free to reach out if you have a project you'd like to work on together.