Skip to content

PDXPythonPirates/pyrate-stocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pyrate Stocks

A simple investment application built with Flask and Python | Explore the docs >>

Table of Contents

Click to expand!

About The Project

This app was created by the first cohort of the Python Pyrates Project, hosted by Matt Phillips and Chris Thompson. We are entry level software developers working together to explore the Flask framework and the software development lifecycle. This app provides an interactive dashboard for users to monitor up-to-date (and historical) stock information.

Built with:

  • Python
  • Flask
  • Bootstrap

Getting Started

Clone repository

$ git clone https://github.com/PDXPythonPirates/pyrate-stocks.git
  • Navigate to the project folder

    $ cd pyrate-stocks
    

Docker

  • Download Docker Desktop: https://www.docker.com/get-started. There are versions available for Linux, Max, and Windows. What is Docker? Docker is a platform for building, running, and shipping applications. Docker packages up an application with everything it needs and allows an app to run and function the same way on any user's local machine.

  • Create a Docker ID: https://hub.docker.com/signup

  • Login: You will be prompted to enter your Docker credentials.

    $ docker login
    
  • Build Docker Image:

    $ ./scripts/build.sh
    
  • Run Application/Docker Container:

    $ ./scripts/run.sh
    # Opens a browser http://localhost:5000
    

Editing Application

  • Stop Running Container:

    $ ./scripts/stop.sh  
    
  • Multiple Edits: For efficiency with multiple edits, it is recommened to create your own virtual enviorment on your local machine. Once all edits are confirmed, just rebuild and run the container with the commands from the Docker section.

    Click to expand! Create a local virtual enviornment
    • Create a new virtual environment

      #conda
      $ conda create -n myenv python=3.8
      

      or

      #venv
      $ python -m venv myenv
      

    Activate virtual environment

    • Activate your new virtual environment

      #conda
      $ conda activate myenv
      

      or

      #venv (Windows)
      $ myenv/Scripts/activate    
      

      or

      #venv (Mac / Unix / WSL)
      $ source myenv/bin/activate
      

    Install requirements.txt

    • Install the required packages

      $ pip install -r requirements.txt
      

    FLASK_ENV Variable

    • Set the flask environment

      #Windows
      $ set FLASK_ENV=fin_app.py
      

      or

      #Mac / Unix / WSL
      $ export FLASK_ENV=fin_app.py
      

    Run application

    • Run the app using Flask

      $ flask run
      

Features

  • Anonymous users are presented with Home, Login, and Signup options.

  • If a new user attempts to login, they will be directed to the signup page.

  • After signup, the user is directed to the login page. Any existing users can go diretly to the login page.

  • After login, the user can navigate to Home, Dashboard, Update, and Logout pages.

  • On the Dashboard page:

    • The user is presented with the curent information on stocks they selected. With any ticker the user chooses to follow, the stocks' current price, high, low, open, and close is pulled via the yFinance package that scrapes data from Yahoo! Finance. Please note: Some tickers are not possible to add on the dashboard due to limitations based on the yFinance Package.

    • The user has options to add and delete stock tickers, and view historical data.

    • In the add ticker input field, the user is presented with recommended tickers as they type in different characters. Suggested tickers are pulled from a .csv file downloaded from nasdaq.com. The user also has the ability to manually enter a ticker that does not appear in the suggestions.

  • On the Update page, the user can change username, password, email and enter stock symbols. The form is preloaded with username, email and any stocks in the account. This inforamtion was preloaded with the assumption that they typically don't change. If user enters new information, it will be saved.

  • The user stays logged in until the user decides to log out.

Styling

Bootstrap and LESS were used for styling. Bootstrap uses class based styling and LESS is a CSS preprocessor. If you're using VSCode, download the Easy LESS extension by mrcrowl. This extension will allow you to easily work with LESS files in VSCode. If you're using another text editor, you'll want to search for a LESS compiler that will compile .less files to .css.

  • To modify the main color palette of the layout, modify the palette.less file.

  • The mixins.less file holds parametric mixins. Mixins hold one or more parameters that are used to extend functionality of LESS by taking arguments and its properties and customize the mixin output when mixed into another block. Mixins also help minimize lines of repeat code. With parametric mixins, you can also create a library of your own frequently used styling, that can be used across other projects.

Resources

Contributors

Special Thanks

Thank you, Chris Thompson and Matt Phillips, for hosting the Python Pyrates Project Cohort 1! We greatly appreciate your guidance and support throughout the creation of this app, as well as the opportunity to experience the software lifecycle on a real-world application.

We encourage any interested developers - regardless of experience - to apply for the next cohort. This is was an amazing experience for all four of us.

License

MIT License

Copyright (c) 2021 Portland Python Pirates

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.