Skip to content

This is the problem set 9 from CS50 2021 which is about a web application using Flask for user to "buy" and "sell" the stock

Notifications You must be signed in to change notification settings

HEI204/CS50-pset9-Finance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS50 Finance (Week9: Problem Set)

Introduction

This is the one of the exercise from CS50x - Introduction for Computer Science: Exercise detail

The target of this exercise:

  • Implement a website that allow user to "buy" and "sell" stock and the following functions:
  • Complete the implementation of register in such a way that it allows a user to register for an account via a form.
  • Complete the implementation of quote in such a way that it allows a user to look up a stock’s current price.
  • Complete the implementation of buy in such a way that it enables a user to buy stocks.
  • Complete the implementation of index in such a way that it displays an HTML table summarizing, for the user currently logged in, which stocks the user owns, the numbers of shares owned, the current price of each stock, and the total value of each holding (i.e., shares times price). Also display the user’s current cash balance along with a grand total (i.e., stocks’ total value plus cash).
  • Complete the implementation of sell in such a way that it enables a user to sell shares of a stock (that he or she owns).
  • Complete the implementation of history in such a way that it displays an HTML table summarizing all of a user’s transactions ever, listing row by row each and every buy and every sell.

Apart from the function required and the built in function provided in this exercise, I also added some function to the website:

  • Allow user to change their password but cannot same as current password
  • Allow user to check their profit for the stock that they have bought
  • Allow users to buy more shares or sell shares of stocks they already own via click the button on the index page, without having to type stocks’ symbols manually.
  • Allow users to add more cash into their account via the add cash page

Tools:

  • Flask for backend development
  • HTML for website strcuture
  • Bootstrap for design
  • IEX API to get the stocks valus in real time
  • sqlite3 for storing users information (username and hashed password) and the transaction record (bought or sold)

Website:

Test account: user012 ; password: 123456

Every user after registered will have $10000 by default

  • Login page: image

  • Register page: image

  • Index page (after login your own accout): it will show about your stock info with the price when you bought and total price for total number of share when you bought. Also, it will show about the latest profit for your stock image

  • Quote page (Input the stock symbol for checking the stock info): image

  • Buy page (Input the stock symbol and number of shares to buy): image

  • Sell page (Select the stock that you have bought in the drop-down list and input the number of shares to sell): image

  • History page (Show all your action on the page such as sell, buy): image

  • Add Cash: image

  • Change password (Allow user to change their password but cannot input the new password same as current password): image

Reference:

About

This is the problem set 9 from CS50 2021 which is about a web application using Flask for user to "buy" and "sell" the stock

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published