Description
This assignment is the second part of a 2-part assignment that focuses on providing you with handson experience with building a real-time stock price analysis and algorithmic trading model. The
first part focused on data collection, storage, and pre-processing to prepare your team to perform
analysis and algorithmic trading on the stored data in Part 2.
In this lab, you will work with your team to analyze the stock price data and calculate the portfolio
returns using Algorithmic trading to devise an algorithm that provides maximum profit.
1) Algorithm Development
Develop simplified algorithms for predicting when to buy and sell stocks based on the collected
real-time stock price data.
Research and develop basic trading algorithms determining when to buy and sell stocks. These
algorithms could be based on simple moving averages, momentum indicators, or any other suitable
technique.
a) References
Use the following resources to understand how the algorithms work and the factors
responsible for the stock market trends.
i) Introduction to Technical Analysis: Investopedia – Technical Analysis
ii) Moving Average Crossover Strategy: Investopedia – Moving Average Strategies
iii) Relative Strength Index (RSI): Investopedia – RSI
b) Algorithm Implementation
Discuss common algorithms: Moving Average, Exponential Smoothing, etc. Implement a
simple Moving Average algorithm on the collected stock price data to kick-start your
implementation strategy.
Discuss more advanced algorithms: ARIMA, LSTM, etc. Explore evaluation metrics for
time series data: Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), etc.
Select an algorithm or develop a hybrid algorithm to predict the stock prices and provide
buy/sell signals.
Implement the chosen algorithm(s) in Python. Create functions that generate buy/sell
signals based on the stock price data.
2) Mock Trading Environment
For this task, you will create a mock trading environment to test the performance of your trading
algorithms.
Define an initial investment fund and allocate it to the chosen stocks for your portfolio. Create a
Python script that tracks the portfolio value over time based on the buy/sell actions determined by
your trading algorithm(s). Maintain a record of the number of shares held for each stock and update
it after each trade.
Choose relevant performance metrics to evaluate the effectiveness of your trading algorithm(s).
Calculate metrics such as total portfolio value, annualized returns, and the Sharpe ratio.
a) References
i) Calculating Portfolio Returns: Investopedia – Calculating Portfolio Returns
ii) Calculating Sharpe Ratio: Investopedia – Sharpe Ratio
3) Extra Credit
Additionally, this week’s submission would be a competition between all teams. Given the same
portfolio and initial starting budget, every team’s algorithm would be run and ranked in order of
the profit generated by their algorithm.
Team whose algorithm provides the maximum profit would receive extra credit for Lab 3.
4) Team Discussions
Your team is expected to meet in-person / virtually each day of the week and discuss the
assignment progress & next steps. Document minutes of each meeting in a separate file.
5) Submission
Make one submission per team. Each team must submit all the code files for the working solution,
a readme document containing information for running the code in pdf format and a document that
outlines the minutes of all team meetings in pdf format.
Provide a video per team which demonstrates the entire working solution and explains which
algorithm was used and the rationale behind it. Also include details about the performance metrics
used by your team. Please include the team name and the name of all three team members in the
video.
There will be a 50% penalty for all late submissions.