{"id":21432371,"url":"https://github.com/lingumd/stock-analysis","last_synced_at":"2026-01-04T03:09:09.933Z","repository":{"id":37330615,"uuid":"505197637","full_name":"lingumd/stock-analysis","owner":"lingumd","description":"Analysis on green energy stocks. Refactor code to make VBA script run faster.","archived":false,"fork":false,"pushed_at":"2022-12-08T04:54:54.000Z","size":2896,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T08:42:58.664Z","etag":null,"topics":["for-loop","if-then","vba-script"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lingumd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-19T19:10:30.000Z","updated_at":"2022-12-08T04:53:52.000Z","dependencies_parsed_at":"2023-01-24T13:00:16.540Z","dependency_job_id":null,"html_url":"https://github.com/lingumd/stock-analysis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingumd%2Fstock-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingumd%2Fstock-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingumd%2Fstock-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lingumd%2Fstock-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lingumd","download_url":"https://codeload.github.com/lingumd/stock-analysis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945321,"owners_count":20372890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["for-loop","if-then","vba-script"],"created_at":"2024-11-22T23:18:18.426Z","updated_at":"2026-01-04T03:09:09.890Z","avatar_url":"https://github.com/lingumd.png","language":null,"readme":"# An Analysis of Green Energy Stocks\nPerforms analysis on green energy stocks.\n#### [green_stocks](./green_stocks.xlsm)\n\n# VBA Stocks Challenge\n#### [VBA_Challenge](./VBA_Challenge.xlsm)\n\n## Overview of Project\nSteve wants to expand the dataset to include the entire green energy stock market over the last few years \nto give his parents the best recommendation of which stocks to invest in.\nDue to the large amount of data, it would take longer to execute the code. \nReduce the time it takes to execute the code by refactoring the code to loop through all the data one time in VBA.\n\n## Results\n\n### Analysis of 2017 Green Energy Stocks\n![2017 Stock Analysis](./VBA_Challenge_2017.png)\n\nIn 2017, all stocks, except for TERP, have a postive return. TERP has a negative return.\nThe stocks with the highest positive returns are DQ, ENPH, FSLR, and SEDG, \nall having a return percentage over 100% and DQ being the highest at 199.4% and SEDG being the second highest at 184.5%.\nAll stocks have a high total daily volume, with CSIQ, ENPH, FSLR, RUN, SEDG, and SPWR being the highest and having all over 200,000,000 shares.\n\nThe code ran in a short amount of time at 0.1875 seconds. The following image is the run time for the original VBA script on the stock data for 2017.\nThe refactored code run time is 0.6015625 seconds shorter than the original VBA script run time for 2017.\n\n#### Original VBA Script 2017 Run Time\n![Original VBA Script 2017 Run Time](./Original_VBA_Script_2017_Run_Time.png)\n\n### Analysis of 2018 Green Energy Stocks\n![2018 Stock Analysis](./VBA_Challenge_2018.png)\n\nIn 2018, only ENPH and RUN have postive returns, all other stocks have negative returns.\nRUN has a higher return than ENPH at 84% and ENPH has a return of 81.9%.\nENPH and RUN both have high total daily volumes, \nwith ENPH having higher total daily volume than RUN at 607,473,500 shares \nand RUN having a total daily volume of 502,757,100 shares.\n\nThe code ran in a short amount of time at 0.125 seconds. The following image is the run time for the original VBA script on the stock data for 2018.\nThe refactored code run time is 0.65625 seconds shorter than the original VBA script run time for 2018.\n\n#### Original VBA Script 2018 Run Time\n![Original VBA Script 2018 Run Time](./Original_VBA_Script_2018_Run_Time.png)\n\n## Summary\nThe advantages of refactoring code is that it can make the run time for executing the code shorter. \nThis makes getting results much quicker and makes the code more usable for the future in case more data is being analyzed later on.\nThis can also make the code more usable and shareable for other individuals or groups for their own datasets they need to analyze.\n\nThe disadvantages is the time it takes to conceptualize and build a refactored code that can achieve the results desired. \nDesigning a refactored code takes time that needs to be taken into account when considering starting the process of refactoring code.\nIt would also take time to debug and refactor the code again when used for other purposes in the future or when used with other individuals or groups and their datasets.\n\nThe advantage of the refactored code is that it used a tickerIndex variable to keep track of the different stocks as it ran through the data in the worksheet,\ntherefore, it could run through the worksheet one time to analyze the stock data and is why there was a shorter run time.\n\nThe disadvantage of the original code is that it did not have a tickerIndex variable and only had a ticker variable to keep track of one stock each time the code ran through the data in the worksheet, therefore, it had to run through the worksheet one time for each of the different stocks being analyzed and, in this code, ran through the worksheet 12 times and is why there was a longer run time.\n\nThe advantage of the original code is that the VBA script is shorter and doesn't involve the time it takes to incorporate the tickerIndex variable.\n\nThe disadvantage of the refactored code is that the VBA script is a bit longer and involves the time it take to incorporate the tickerIndex variable, and overall, takes more time to build.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flingumd%2Fstock-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flingumd%2Fstock-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flingumd%2Fstock-analysis/lists"}