Question: UI REST API Services Database This application will help users to plan and manage a stock brokerage system. Overview: The user has the option to

UI REST API Services Database This application will help users to plan and manage a stock brokerage system. Overview: The user has the option to manage the investors, their individual stocks, and their individual bonds. Thus, you will need to create at least the following tables: investor, stock, bond, stocktransaction, bondtransaction. For all tables, the id should be the primary key, and autogenerated. Pick appropriate data types for each column. The investor table should at minimum contain the following columns: id, firstname, lastname The stock table should have the following columns: id, stockname, abbreviation, currentprice The bond table should have the following columns: id, bondname, abbreviation, currentprice The stocktransaction table should have the following columns: id, date, investorid, stockid, quantity The id and date should be automatically generated. The investorid column is a foreign key to the investor table, indicating who performed the transaction. The stockid column is a foreign key to the stock table identifying the stock for the transaction. The quantity, if positive, shows a buy, if negative, shows a sale. The bondtransaction table should have the following columns: id, date, investorid, bondid, quantity The id and date should be automatically generated. The investorid column is a foreign key to the investor table, indicating who performed the transaction. The bondid column is a foreign key to the bond table identifying the bond for the transaction. The quantity, if positive, shows a buy, if negative, shows a sale. There is one important rule that must always be adhered to: a sale can never exceed the current possession of a stock or bond. You must check an investors current possession of a certain stock, before they can sell it. There are multiple ways to approach this: you can create additional tables if youd like, or calculate current possession with the help of registered transactions. It is up to you whether to handle this logic in the front end, or the back end. The necessary user stories that need to be fulfilled are: User creates, updates, deletes, or selects an investor. User creates, updates, or deletes a bond. User creates, updates, or deletes a stock. User sees the investors current portfolio (stocks and bonds). User makes a transaction for the investor (either buy or sell a stock or bond) User cancels (deletes) a transaction (stock or bond) entirely. Therefore, you will need CRUD APIs for all of your tables. Depending on your implementation, this includes single and/or multiple records at once. For simplicity we assume every investor has unlimited money and we do not have to worry about having enough funds to make a purchase. You can also assume the user inputs only valid data, and you do not have to error-check user input (for instance inputting strings into a number field). Note: When the user creates a transaction, the user should have to pick an existing investor, and an existing stock/bond (e.g. from a dropdown, or a list), and should not have to type it as an input (where errors could happen)
If you want can you create one that I can learn and see how to use it I know I need a creds.py that I already have that I can import for each table that has my database information
These are also the imports that we have discussed in class if you use another one please keep it to a minimum thank you
import flask
from flask import jsonify
from flask import request
from sql import DBconnection
from sql import execute_read_query
from sql import execute_update_query
import creds
and the sql side
import mysql.connector
from mysql.connector import Error
def DBconnection(hostname, uname, pwd, dbname):
con = None
try:
con = mysql.connector.connect(
host = hostname,
user = uname,
password = pwd,
database = dbname
)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!