π This video is a walkthrough of solving problem set 9 of CS50's Finance module.
π» The goal is to build a website where users can buy and sell shares, requiring registration and login functionality.
π To access share values, an API call is made using a registered API key.
β Registering a new user by hashing their password and adding them to the database.
π Storing user information using session and redirecting them to their account after registration.
π Implementing a route to allow users to look up a stock's current price.
β The lookup function in helpers.py connects to the API using an API key and retrieves stock information based on a symbol.
π If the stock symbol exists, the lookup function returns the name, price, and symbol of the stock. Otherwise, it returns that the symbol doesn't exist.
π° The quoted.html file receives the stock information from the lookup function and displays the name, price, and symbol of the stock.
ππ The buy route allows users to enter a symbol and the number of shares they want to buy. It checks if the user can afford the shares at the current price and updates the database with the transaction details.
π° Calculating the transaction value by multiplying the number of shares with the stock price.
πΈ Checking if the user has enough money by comparing their cash with the transaction value.
π Updating the user's cash by subtracting the transaction value and updating the transaction table with the user ID, symbol, shares, price, and date.
π‘ Extract relevant information about the user and their transactions to display in a table on the website.
π° Calculate the total amount of shares and cash the user has.
π Create an HTML table using the extracted information to display the user's portfolio.
π‘ Creating a new row in the table to display the total cash amount.
π Implementing the sell functionality to allow users to sell shares.
π Performing various checks to ensure the user enters valid information and updating the user's cash and transaction tables accordingly.
The video covers the implementation of a feature that allows users to sell shares based on their account balance.
The video shows how to summarize and display the user's transaction history on their account.
The video also demonstrates adding a personal touch by allowing users to add additional cash to their accounts.