Perform analysis on Stocks to help Steve
Refractoring the VBA code to analyze Stocks Data for Steve to make it more efficient
Steve has an excel file with stock data to analyze and he needs macros to run the analysis on new data in the future. By doing this analysis he wants to convince his parents to invest green enegergy stocks which has great revenue in the future.
Refractoring the provided Code to run analysis for each year for all tickers, 2017 and 2018, respectivelt. In this proccess I used code which loop through all the data one time which more efficient and takes significantly less time to execute.
- The main difference between the code from the macros we wrote during the module and the code for this challenge is we need to use tickerIndex to access the correct index across the arrays we created for this challenge, they are tickers array and three output arrays as below:
- Create for loops to loop through the 4 arrays to output the "Ticker", "Total Daily Volume", and "Return" columns in the spread sheet as follwoing for 2017 and 2018, respectively.
Apparently, stocks return overall was much better in 2017 as compare to 2018 where most of the stocks return are negative.
- I measured the perforamnce of the macro after refractoring which is much faster than previous code.
- Refractoring the code makes my code more neat, fewer codes, and faster exeute time.
- These advantages mentioned above applied to the original VBA nicely, made it significantly fater than older one, almost 10 times faster. However, disadvantage for me was to understand to use tickerIndex in the right place to go through all the indexs in the arrays, this gave me very hard time.