Git Product home page Git Product logo

stock_analysis's Introduction

Stock_Analysis

Overview

VBA is a programming language that interacts directly with Excel worksheets and cells, allowing us to write scripts to automate simple tasks, allowing even more analytical power to Excel. VBA is often used in the financial industry, where Steve just graduated with his Finance degree, and his parents are his first customers curious about investing. Though his clients are primarily interested in DAQO New Energy corporation (DQ), Steve wants to diversify and analyze other green energy stock options against DQ to offer the client variety. Using VBA, in this module, a macro will be created that can trigger pop-ups and inputs, read and change cell values, and format cells to consolidate and compare 12 stock options.

Data Environment:

  • VBA
  • Microsoft Excel

Results

Screen Shot 2022-10-04 at 8 33 06 AM

Stock performance:

  • DQ, the stock interest for this project, was the highest performing stock in 2017 (199.4%) but had the most vast performance pivot in 2018 (-62%).
  • RUN’s rate of return increased 78.55% making it the greatest increase when all the other stock were failing
  • ENPH, one of the top performing stocks (129.5%) in 2017 fell in 2018 but was able to maintain a positive ROR performance, indicative of a well founded stock option.
  • TERP’s rate of return was down (-7%) in 2018 and fell even lower in 2017 (-5%), denoting a negative return from YTD and low purchase interest

Code Performance:

The original code for AllStockAnalysis() ran in:

  • 0.26 seconds: 2017
  • 0.37 seconds: 2018

Screen Shot 2022-10-04 at 8 34 17 AM

The AllStockAnalysisRefactored() ran in:

  • 0.08 seconds: 2017
  • 0.07 seconds: 2018

Screen Shot 2022-10-04 at 8 35 29 AM

  • The refactored code reduce processing time by creating empty arrays to hold data and nested IF:Then statements that looped through the data one time and collected all of the information for simultaneous calculations. verses the original code that ran the calculation for each ticker 1 by 1

Screen Shot 2022-10-04 at 1 36 57 AM

Screen Shot 2022-10-04 at 1 34 11 AM

Summary

In a summary, There are advantages to refactoring code:

  • Improves functionality of code by removing redundancies and duplications
  • Executes code faster
  • Organizes code better

-And disadvantages to refactoring code:

  • could introduce new bugs and errors into the code

For this exercise, Refactoring the original code made it’s organization more concise, Improved the processing times, and Improved the functionality for future testability.

stock_analysis's People

Contributors

tracari avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.