Skip to content

celenbaas/stock-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stock Market Analysis with Excel VBA

Overview of Project

This analysis uses VBA within Excel to find the total daily volume and yearly return for each stock. Daily volume is the total number of shares traded throughout the day; it measures how actively a stock is traded. The yearly return is the percentage difference in price from the beginning of the year to the end of the year.

In addition to the data analysis the VBA code was refracted to improve performance.

Results

(1) Compare the stock performance between 2017 and 2018. The analysis was performed on 12 stocks comparing 2017 returns to 2018. Overall, 10 of the 12 stocks saw significate declines in their yearly return. Stock Ticker RUN saw the largest increase from 2017 to 2018. While Stock Ticker TERP saw a slight uptick in return going from lose of -7.2% in 2017 to -5% in 2018.

Performance 2017 to 2018

(2) Compare the execution times of the original script and the refactored script. The execution times for the original VBA code for 2017 and 2018 were 6 seconds. When refactored the code ran for 5 seconds, see screen shots for exact times below. This is an improvement of 1 second.

VBA_Challenge_2017

VBA_Challenge_2018

Summary

(1) What are the advantages or disadvantages of refactoring code? Refactoring is an important part of coding. When refactoring code, the focus is on making the code more efficient by improving the logic to make it easier to read, taking fewer steps or using less memory.

In general refactoring is a good thing, however there is a balance of the time and effort it takes along with the payoff. Delaying insights to decision makers should always be considered along with the benefits of clean good functioning code.

(2) How do these pros and cons apply to refactoring the original VBA script? The focus on refactoring this VBA script was not on adding new functionality but was to make the code more efficient. This was done by taking fewer steps, using less memory, and improving the logic of the code to make it easier for future users to read.

About

Analysis in Excel using VBA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors