Coder Social home page Coder Social logo

hneels / cs50-finance Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 20.0 125 KB

A web app for managing a stock portfolio, making transactions, and checking real-time stock prices.

License: MIT License

Python 60.63% CSS 2.57% HTML 36.80%
bootstrap flask flask-session html python sql

cs50-finance's Introduction

Finance: A Stock Portfolio

Project for Week 8 of Harvard's CS50

View the full assignment description on CS50's OpenCourseWare

screenshot of finance project

Technologies

  • Python
  • Flask with session authentication
  • SQL
  • HTML
  • Bootstrap

Summary

Finance is a web app that allows logged-in users to "buy" and "sell" stocks (with pretend money) as well as look up real stock quotes fetched from IEX API. Users can also view their stock portfolio transaction history.

How to Run

  1. Clone this repository, navigate to the project and type the following commands:
  2. Activate a virtual environment: 'python3 -m venv .venv' then select the virtual environment as the active workspace
  3. Install dependencies: 'pip install -r requirements.txt'
  4. Run command 'export FLASK_APP=application.py' to set the Flask environment variable
  5. Configure and export your API key with these instructions
  6. Run command 'flask run' to open on localhost
  7. When the finance site opens in your browser, register for a new account (upper right corner) to create your own stock portfolio

Views

Register

Allow a new user to register for an account, rendering an apology view if the form data is incomplete or if the username already exists in the database.

Index

The homepage displays a table of the logged-in user's owned stocks, number of shares, current stock price, value of each holding. This view also shows the user's imaginary "cash" balance and the total of their "cash" plus stock value.

Quote

Allows the user to submit a form to look up a stock's current price, retrieving real-time data from the IEX API. An error message is rendered if the stock symbol is invalid.

Buy

Allows the user to "buy" stocks by submitting a form with the stock's symbol and number of shares. Checks to ensure the stock symbol is valid and the user can afford the purchase at the stock's current market price with their available balance, and stores the transaction history in the database.

Sell

Allows the user to "sell" shares of any stock currently owned in their portfolio.

History

Displays a table summarizing the user's past transactions (all buys and sells). Each row in the table lists whether the stock was bought or sold, the stock's symbol, the buy/sell price, the number of shares, and the transaction's date/time.


Please note that the Login and Logout functions and all functions in helpers.py came with the assignment starter code and are not my work. Starter code ©2020 David J. Malan/ Harvard

cs50-finance's People

Contributors

hneels avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cs50-finance's Issues

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.