๐ 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.