Skip to content

MadTown86/SSC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

Simple Stock Checker (SSC)

-Learning Exercise : Simple Stock Checker
-Date: 10/24/2022
-Author: GD

Goal:

The purpose of this application is to grade stocks automatically based on fetched financial information. Over time, using regression analysis, one could gauge whether the grading algorithm had a positive correlation with upward price movement. (Example: 'A' grade bin of stocks has strongest correlation with upward price movement at 1mo, 2mo, 3mo intervals). Tweak the grading algorithm until positive correlation could be reasonably assured. Speculate accordingly.

Introduction

The user selects a .txt file of ticker symbols as input and outputs a grade into a local MySQL database and an xlsx gradesheet into ..\sscpackage\storage\excelstorage.

The application has a GUI for ease of file selection. The GUI has additional basic functionality, such as reviewing the selected files contents and displaying the contents of the MySQL database, as well as updating the text box with status information.

After a file is selected and the user clicks 'submit', the app fetches historical financial documents from RapidApi. The data fetched includes Balance Sheets, Income Statements, Financial Ratios, Analyst Ratings, Industry and Sector information. SSC reorganizes the data, grades it and outputs the grade and all core associated information into a local mySQL database.

Dependencies

  • mysql_connector_repackaged==0.3.1
  • openpyxl==3.0.10
  • pandas==1.5.1
  • python-dotenv==0.21.0
  • requests==2.28.1
  • schedule==1.1.0
  • xlsxwriter==3.0.3

Setup & Basic Usage

In order to get this application to function locally from within an IDE. You will need to update the following items on your local machine:

  1. Root Locations and .ENV file
  2. API Key Registration and additional Environment Variables
  3. Create or Associate a MySQL Server

1. Root Locations and .ENV file

Update environment variables

a. "LO_ROOT" = location of .ENV file within sscpackage - update this in your local machine environment variables

dotenv.load_dotenv(dotenv_path=os.getenv("LO_ROOT"))
ROOT_VAR_SSC = os.getenv("CORE_DIR_STOR")

b. "CORE_DIR_STORE" = path to the ".sscpackage\storage" folder on your local machine - update this in the .ENV file

"CORE_DIR_STORE" = "yourpathhere.\sscpackage\storage\"

2. API Key Registration and additional Environment Variables

a. Sign up for a personal free account on *RapidApi

b. Create an 'application' in your rapidapi.com account

Image from RapidApi

c. Make note of your securitykey and create environment variable "RAPI_key"

headers = {
     "x-rapidapi-host": "yh-finance.p.rapidapi.com",
     "x-rapidapi-key": os.getenv("RAPI_key"),
}

3. Create or Associate a MySQL Server

a. Create a server with MySQL Workbench

Or use other software that can create an appropriate 'host' location for pythons mysql.connector

b. Create local machine environment variables for "localhost", "DB_USER", "DB_PASS"

host=os.getenv("localhost"),
user=os.getenv("DB_USER"),
password=os.getenv("DB_PASS")

Usage

  1. Find and run if 'name == "main":' section of module 'mainssc.py'
if __name__ == "__main__":
    CS = ControlBoardSSC()
    CS.gui.start_gui.ssc()

Example Image of GUI

GUI Example

  1. Click 'browse' and select a file with comma separated ticker symbols

TickerList

  1. Click 'Submit' button and program should run through list of ticker symbols and final outcome will be stored in local database

Otherwise click on the 'show db' button on the GUI to check stored values
GUIShowDB Button

Control Flow Image

Imgur

About

Learning Exercise : Stock Screener

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages