DBMS Report Devansh
DBMS Report Devansh
Project Report
Submitted by
Devansh Gupta [RA2311026010260]
Arnav Anand [RA2311026010259]
Under the guidance of
Dr. G. Dinesh
Assistant Professor, Department of Computational Intelligence
In partial satisfaction of the requirements for the degree of
BACHELOR OF TECHNOLOGY
In
COMPUTER SCIENCE AND ENGINEERING
With Specialization in Artificial Intelligence and Machine Learning
May 2025
i
ABSTRACT
Our system helps in maintaining structured and relational data for markets,
brokers, and buyers, ensuring accurate tracking of stock purchases and sales. The
current system relies heavily on manual record-keeping or fragmented software
solutions, which may lead to errors or delays in decision-making. The proposed
system aims to eliminate these challenges by providing an automated database-
driven backend supported with triggers, cursors, and views for real-time updates
and data consistency.
ii
TABLE OF CONTENTS
ABSTRACT ii
TABLE OF CONTENTS iii
LIST OF FIGURES vi
LIST OF TABLES viii
1 PROBLEM UNDERSTANDING 1
1.1 Problem Statement 1
1.1.1 Problem Description 1
1.2 ER Diagram for Stock Management System 2
1.2.1 Stock Entity 3
1.2.2 Broker Platform Entity 3
1.2.3 Buyer Entity 4
1.2.4 Keys in ER Diagram 5
iii
2.3.6 Buyer Table 11
2.3.7 Portfolio Table 12
2.3.8 Dividend Table 12
2.3.9 Buys Table 13
2.3.10 Update Table 14
2.3.11 Has Table 15
3. COMPLEX QUERIES 16
3.1 Views 16
3.2 Triggers 17
3.3 Cursors 19
iv
5.1.8 Dividend Table 24
5.1.9 Buys Table 25
5.1.10 Update Table 25
5.1.11 Has Table 25
5.2 Normalisation in Stock Management System 25
5.2.1 Markets Table 25
5.2.2 Stocks Table 25
5.2.3 Types Table 26
5.2.4 BrokerPlatform Table 26
5.2.5 Information Table 26
5.2.6 Buyer Table 26
5.2.7 Portfolio Table 27
5.2.8 Dividend Table 27
5.2.9 Buys Table 28
5.2.10 Update Table 28
5.2.11 Has Table 28
7. CODE 42
7.1 Dashboard.py 42
7.2 Db_config.py 45
7.3 Main.py 46
7.4 Portfolio.py 52
v
8. OUTPUT SCREENSHOT 64
8.1 Broker 64
8.2 Buyer 68
10. CONCLUSION 76
vi
List of Figures
vii
8.5 Transactions of All the Buyers 66
viii
List of Tables
ix
CHAPTER 1
PROBLEM UNDERSTANDING
1
1.2 ER Diagram for Stock Management System
• Stock Name: The name of the stock (e.g., Apple Inc., Tesla Inc.).
• Stock ID: A unique identifier for each stock (e.g., a numerical code).
Þ Quality: May refer to the quality of the stock (e.g., blue-chip, penny
stock), or it could be a placeholder for other relevant information.
2
§ Delivery: Indicates whether the stock is for delivery (physical
or electronic transfer) or for intraday trading.
• Websites: The website or online presence of the broker, one broker can
have more than one website.
• Information: It stores the information about broker and has further sub
attributes.
3
1.2.3 Buyer Entity
• Demate Acc: The buyer's demat account number (used for holding
securities electronically).
Þ Linked Bank Ac: The bank account linked to the buyer's demat
account for fund transfers.
Þ KYC status: Indicates whether the buyer has completed the Know
Your Customer (KYC) verification process.
• Pan Number: The buyer's Permanent Account Number (used for tax
purposes).
• Capital: The available capital or funds in the buyer's account for investing.
• Portfolio ID: A unique identifier for each portfolio created by the buyer.
4
1.2.4 Keys in Our ER Diagram
• Stock:
• Broker:
• Buyer:
Þ Candidate Keys: (Buyer ID, Aadhar ID), (Buyer ID, Demate Acc)
5
CHAPTER 2
RELATION – SCHEMA AND CREATION OF TABLES
2.1 Relationships :
• Has: Broker Platform has details of buyer, who has purchased stocks from
which broker. Similarly, we can say buyer also has some information about
the broker.
• Updates: Broker Platform updates the stocks table, adding and selling the
stocks.
• Buys: The buyer buys stocks from the Stocks table thus providing a buying
relationship.
2.2 Cardinalities :
• Buyer To Stocks: It has one to many cardinalities as one buyer can have
multiple stocks.
• Buyer To Portfolio ID: It has one to one cardinality as one buyer can have
one portfolio accounting all the stocks.
• Buyer To Broker Platform: It has one to many cardinalities as one buyer
can buy stocks from multiple brokers and multiple platforms.
• Broker Platform To Stocks: It has Many to Many cardinalities as many
platforms may have same or different stocks.
• Broker Platform To Information: It has one to many cardinalities as it
can hold information of many brokers.
6
Fig 2.1 Database Schema for Stock Management System
Schema:
• Market(MarketId [PK], Type, Country)
• This table stores details about stock markets.
• No foreign keys here; it's a base entity.
• CREATE TABLE Market ( MarketId INT PRIMARY KEY,
Type VARCHAR(50), Country VARCHAR(50) );
7
Fig 2.2: Table ‘Market’ as defined in MySQL
Schema:
8
2.3.3. Types Table
Schema:
Types(TypeId [PK], StockId [FK → Stocks(StockId)], Indicator,
Delivery, Quality, Lots, Quantity, Units)
• Relation: One stock can have multiple type attributes like
delivery, lots, and quality.
• StockId used as FK to link with Stocks table (1:M
relationship).
• CREATE TABLE Types ( TypeId INT PRIMARY KEY
AUTO_INCREMENT, StockId INT, Indicator
VARCHAR(50), Delivery VARCHAR(50), Quality
VARCHAR(50), Lots INT, Quantity INT, Units
VARCHAR(20), FOREIGN KEY (StockId) REFERENCES
Stocks(StockId) );
Schema:
BrokerPlatform(PlatformId [PK], Name, MobileNumber, Website,
Commission)
• Contains data about trading platforms.
• No FKs; it is a master entity.
9
• CREATE TABLE BrokerPlatform ( PlatformId INT PRIMARY
KEY, Name VARCHAR(100), MobileNumber VARCHAR(15),
Website VARCHAR(100), Commission DECIMAL(5, 2) );
Schema:
Information(InfoId [PK], BrokerId [FK →
BrokerPlatform(PlatformId)], StockId [FK → Stocks(StockId)],
BuyerId)
• Relation: Shows which brokers deal in which stocks for which
buyers.
• Many-to-one from Information → BrokerPlatform
• Many-to-one from Information → Stocks
• CREATE TABLE Information ( InfoId INT PRIMARY KEY
AUTO_INCREMENT, BrokerId INT, StockId INT, BuyerId
INT, FOREIGN KEY (BrokerId) REFERENCES
BrokerPlatform(PlatformId), FOREIGN KEY (StockId)
REFERENCES Stocks(StockId) );
10
Fig 2.6 : Table ‘Information’ as defined in MySQL
Schema:
Buyer(BuyerId [PK], Name, Email, MobileNumber, AadharId,
Capital, KYCStatus, PANNo, LinkedBankAccount, DematAccount,
ProfitLoss)
• Core table for investors.
• No foreign keys directly, but referenced in many other tables.
• CREATE TABLE Buyer ( BuyerId INT PRIMARY KEY,
Name VARCHAR(100), Email VARCHAR(100),
MobileNumber VARCHAR(15), AadharId VARCHAR(20),
Capital DECIMAL(15, 2), KYCStatus VARCHAR(20),
PANNo VARCHAR(20), LinkedBankAccount
VARCHAR(50), DematAccount VARCHAR(50), ProfitLoss
DECIMAL(15, 2) );
11
2.3.7. Portfolio Table
Schema:
Portfolio(PortfolioId [PK], BuyerId [FK → Buyer(BuyerId)],
StockId [FK → Stocks(StockId)], StockName, Quantity,
PurchasePrice)
• Relation: One buyer can hold multiple stocks (1:M), hence
BuyerId is a FK.
• Also links to Stocks for the related stock.
• CREATE TABLE Portfolio ( PortfolioId INT PRIMARY KEY
AUTO_INCREMENT, BuyerId INT, StockId INT, StockName
VARCHAR(100), Quantity INT, PurchasePrice DECIMAL(10,
2), FOREIGN KEY (BuyerId) REFERENCES Buyer(BuyerId),
FOREIGN KEY (StockId) REFERENCES Stocks(StockId) );
Schema:
Dividend(DividendId [PK], BuyerId [FK → Buyer(BuyerId)], Date,
Amount)
• Relation: A buyer can receive multiple dividends (1:M), so
BuyerId is a FK.
• CREATE TABLE Dividend ( DividendId INT PRIMARY KEY
AUTO_INCREMENT, BuyerId INT, Date DATE, Amount
DECIMAL(10, 2), FOREIGN KEY (BuyerId) REFERENCES
Buyer(BuyerId) );
12
Fig 2.9 : Table ‘Dividend as defined in MySQL
Schema:
Buys(BuyerId [PK, FK → Buyer(BuyerId)], StockId [PK, FK →
Stocks(StockId)])
• Represents many-to-many relationship between Buyer and
Stocks.
• Composite PK with both as FKs.
• CREATE TABLE Buys ( BuyerId INT, StockId INT,
PRIMARY KEY (BuyerId, StockId), FOREIGN KEY
(BuyerId) REFERENCES Buyer(BuyerId), FOREIGN KEY
(StockId) REFERENCES Stocks(StockId) );
13
2.3.10. Updates Table
Schema:
Updates(StockId [PK, FK → Stocks(StockId)], PlatformId [PK, FK
→ BrokerPlatform(PlatformId)])
• Relation: A stock can be available on multiple platforms and
vice versa.
• Many-to-many relationship.
• CREATE TABLE Updates ( StockId INT, PlatformId INT,
PRIMARY KEY (StockId, PlatformId), FOREIGN KEY
(StockId) REFERENCES Stocks(StockId), FOREIGN KEY
(PlatformId) REFERENCES BrokerPlatform(PlatformId) );
14
2.3.11. Has Table
Schema:
Has(BuyerId [PK, FK → Buyer(BuyerId)], MobileNumber [PK])
• Relation: A buyer can have multiple contact numbers.
• Composite primary key, MobileNumber is not a FK but part of
uniqueness.
• CREATE TABLE Has ( BuyerId INT, MobileNumber
VARCHAR(15), PRIMARY KEY (BuyerId, MobileNumber),
FOREIGN KEY (BuyerId) REFERENCES Buyer(BuyerId) );
15
Chapter 3
COMPLEX QUERIES
3.1 Views:
1. Create a view showing all buyers with stock details where the
quantity bought is greater than 100.
16
3. View showing each stock with average purchase price and total
quantity held across all buyers.
3.2 Triggers:
1. Trigger to update ProfitLoss in Buyer table after inserting into
Portfolio.
DELIMITER //
BEGIN
UPDATE Buyer
END //
DELIMITER ;
17
2. Trigger to insert a record into Dividend table when a buyer’s
capital exceeds 10,00,000.
DELIMITER //
BEGIN
END IF;
END //
DELIMITER ;
18
3.3 Cursors:
1. Cursor to calculate and display total capital of each buyer.
DELIMITER $$
CREATE PROCEDURE ShowBuyerCapital()
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE b_name VARCHAR(100);
DECLARE b_capital DECIMAL(15,2);
DECLARE cur CURSOR FOR SELECT Name, Capital FROM Buyer;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done =
TRUE;
OPEN cur;
read_loop: LOOP
FETCH cur INTO b_name, b_capital;
IF done THEN
LEAVE read_loop;
END IF;
SELECT CONCAT('Buyer: ', b_name, ' has Capital: ', b_capital) AS
Info;
END LOOP;
CLOSE cur;
END $$
DELIMITER ;
-- To call:
CALL ShowBuyerCapital();
19
2. Cursor to update stock prices by increasing them by 5% if price <
500.
DELIMITER $$
CREATE PROCEDURE IncreaseStockPrices()
BEGIN
DECLARE s_id INT;
DECLARE s_price DECIMAL(10,2);
DECLARE done INT DEFAULT FALSE;
DECLARE cur CURSOR FOR SELECT StockId, Price FROM Stocks
WHERE Price < 500;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done =
TRUE;
OPEN cur;
price_loop: LOOP
FETCH cur INTO s_id, s_price;
IF done THEN
LEAVE price_loop;
END IF;
UPDATE Stocks SET Price = s_price * 1.05 WHERE StockId =
s_id;
END LOOP;
CLOSE cur;
END $$
DELIMITER ;
-- To execute:
CALL IncreaseStockPrices();
20
Chapter 4
4.1 Redundancy
StockName is already stored in the Stocks table, so adding it again to
Portfolio, Information, or other related tables results in data duplication.
For every entry referring to the same StockId, the StockName will be
repeated.
21
4.5 Data Integrity Risk
If StockName is manually entered or inserted alongside StockId, there’s a
risk of mismatch — incorrect StockName being associated with a valid
StockId.
22
Chapter 5
DEPENDENCIES AND NORMALISATION IN STOCK
MANAGEMENT SYSTEM
23
5.1.5 Information Table
Attributes: InfoId, BrokerId, StockId, BuyerId
Functional Dependency:
InfoId → BrokerId, StockId, BuyerId
24
5.1.9 Buys Table
Attributes: BuyerId, StockId
Functional Dependency:
BuyerId + StockId → ∅ (no other attributes)
25
5.2.3 Types Table
Attributes: (TypeId, StockId, Indicator, Delivery, Quality, Lots,
Quantity, Units)
1NF: Atomic attributes.
2NF: Full functional dependency on TypeId.
3NF: No transitive dependencies. In 3NF.
26
5.2.7 Portfolio Table
Attributes: (PortfolioId, BuyerId, StockId, StockName, Quantity,
PurchasePrice)
First Normal Form (1NF):
All attributes are atomic and contain only single values.
1NF is satisfied.
Second Normal Form (2NF):
Primary Key: PortfolioId (assumed to uniquely identify each
portfolio entry)
In the original table, StockName was dependent only on StockId, not
on the full primary key PortfolioId.
This was a partial dependency, violating 2NF.
After removing StockName, all attributes (BuyerId, StockId,
Quantity, PurchasePrice) are fully dependent on PortfolioId.
2NF is now satisfied.
Third Normal Form (3NF):
In the updated table, there are no transitive dependencies.
All non-key attributes depend only on the primary key.
Thus, 3NF is also satisfied.
27
5.2.9 Buys Table
Attributes: (BuyerId, StockId)
Composite primary key.
1NF, 2NF, 3NF: Each row uniquely identified and no redundancy.
In 3NF.
28
Chapter 6
CONCURRENCY AND RECOVERY MECHANISMS
6.1 CalculateTotalInvestment()
DELIMITER //
BEGIN
retry_loop: LOOP
START TRANSACTION;
29
OPEN buyerCursor;
read_loop: LOOP
IF done THEN
LEAVE read_loop;
END IF;
FROM Portfolio
FOR UPDATE;
SET totalInvestment = 0;
END IF;
UPDATE Buyer
END LOOP;
30
CLOSE buyerCursor;
IF deadlock_occurred THEN
ROLLBACK;
ITERATE retry_loop;
ELSE
COMMIT;
LEAVE retry_loop;
END IF;
END LOOP;
END //
DELIMITER ;
DELIMITER //
BEGIN
31
DECLARE deadlock_occurred BOOLEAN DEFAULT FALSE;
-- Deadlock handler
-- Retry mechanism
retry_loop: LOOP
START TRANSACTION;
OPEN buyerCursor;
read_loop: LOOP
IF done THEN
LEAVE read_loop;
END IF;
32
SELECT SUM(Quantity * PurchasePrice) INTO totalHolding
FROM Portfolio
FOR UPDATE;
SET totalHolding = 0;
END IF;
END LOOP;
CLOSE buyerCursor;
IF deadlock_occurred THEN
ROLLBACK;
ITERATE retry_loop;
ELSE
COMMIT;
33
LEAVE retry_loop;
END IF;
END LOOP;
END //
DELIMITER;
DELIMITER //
BEGIN
-- Deadlock handler
34
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done =
1;
-- Retry mechanism
retry_loop: LOOP
START TRANSACTION;
OPEN stockCursor;
read_loop: LOOP
IF done THEN
LEAVE read_loop;
END IF;
FROM BrokerPlatform
FOR UPDATE;
FROM Stocks
UPDATE Stocks
END LOOP;
CLOSE stockCursor;
IF deadlock_occurred THEN
ROLLBACK;
ITERATE retry_loop;
ELSE
COMMIT;
LEAVE retry_loop;
END IF;
END LOOP;
END //
DELIMITER ;
36
6.4 UpdateStockPriceAfterTransaction
DELIMITER //
BEGIN
retry_loop: LOOP
START TRANSACTION;
FROM Stocks
FOR UPDATE;
UPDATE Stocks
ROLLBACK;
ITERATE retry_loop;
ELSE
COMMIT;
LEAVE retry_loop;
END IF;
END LOOP;
END //
DELIMITER;
6.5 UpdateProfitLossAfterPurchase
DELIMITER //
BEGIN
retry_loop: LOOP
38
SET deadlock_occurred = FALSE;
START TRANSACTION;
FROM Portfolio
FOR UPDATE;
UPDATE Buyer
IF deadlock_occurred THEN
ROLLBACK;
ITERATE retry_loop;
ELSE
COMMIT;
LEAVE retry_loop;
END IF;
END LOOP;
END //
DELIMITER ;
39
6.6 DeleteAssociateDataOnStockDeletion
DELIMITER //
BEGIN
retry_loop: LOOP
START TRANSACTION;
IF deadlock_occurred THEN
ROLLBACK;
40
ITERATE retry_loop;
ELSE
COMMIT;
LEAVE retry_loop;
END IF;
END LOOP;
END //
DELIMITER ;
41
Chapter 7
CODE
7.1 Dashboard.py
import ttkbootstrap as tb
root = tb.Window(themename="darkly")
root.geometry("500x350")
btn_frame = tb.Frame(root)
btn_frame.pack(pady=20)
if role == "Buyer":
# Buyer buttons
command=lambda: open_portfolio_window(username),
42
tb.Button(btn_frame, text="View Stocks",
command=lambda: open_portfolio_window(username,
"transactions"),
else:
# Broker buttons
command=lambda: open_portfolio_window("all",
"transactions"),
root.mainloop()
44
7.2 Db_config.py
import mysql.connector
def get_connection():
try:
return mysql.connector.connect(
host="localhost",
user="root",
password="Red_Spidy",
database="Stock_Management"
except Error as e:
return None
45
7.3 Main.py
### db_config.py
import mysql.connector
def get_connection():
return mysql.connector.connect(
host="localhost",
user="root",
password="Red_Spidy",
database="Stock_Management"
### login.py
import tkinter as tk
def login_window():
root = ttk.Window(themename="darkly")
root.title("Login")
46
root.geometry("300x250")
ttk.Label(root, text="Username").pack(pady=5)
user_entry = ttk.Entry(root)
user_entry.pack()
ttk.Label(root, text="Password").pack(pady=5)
pass_entry.pack()
def login():
conn = get_connection()
cursor = conn.cursor()
(user_entry.get(), pass_entry.get()))
result = cursor.fetchone()
if result:
root.destroy()
open_dashboard(user_entry.get())
else:
root.mainloop()
### dashboard.py
import tkinter as tk
def open_dashboard(username):
root = ttk.Window(themename="cyborg")
root.geometry("500x300")
### buyers.py
import tkinter as tk
def open_buyer_window():
win = ttk.Toplevel()
win.title("Buyers")
win.geometry("500x400")
conn = get_connection()
cursor = conn.cursor()
records = cursor.fetchall()1
conn.close()
49
### stocks.py
import tkinter as tk
def open_stock_window():
win = ttk.Toplevel()
win.title("Stocks")
win.geometry("500x400")
conn = get_connection()
cursor = conn.cursor()
records = cursor.fetchall()
conn.close()
### portfolio.py
import tkinter as tk
50
import ttkbootstrap as ttk
def open_portfolio_window():
win = ttk.Toplevel()
win.title("Portfolio")
win.geometry("500x400")
conn = get_connection()
cursor = conn.cursor()
records = cursor.fetchall()
conn.close()
### main.py
if __name__ == "__main__":
login()
51
7.4 Portfolio.py
import ttkbootstrap as tb
import mysql.connector
try:
conn = get_connection()
cursor = conn.cursor()
win = tb.Toplevel()
win.title(
win.geometry("1100x700")
# Summary frame
summary_frame = tb.Frame(win)
52
if username == "all": # Broker view
investor_count = cursor.fetchone()[0]
total_investment = cursor.fetchone()[0] or 0
cursor.execute(
total_pl = cursor.fetchone()[0] or 0
total_dividends = cursor.fetchone()[0] or 0
padx=10)
side="left", padx=10)
if view == "portfolio":
cursor.execute("""
p.PurchasePrice, s.Price,
FROM Portfolio p
""")
54
show="headings")
tree.heading("buyer", text="Buyer")
tree.heading("stock", text="Stock")
tree.heading("qty", text="Qty")
tree.heading("invest", text="Investment")
tree.heading("profit", text="P/L")
tree.column("buyer", width=120)
tree.column("id", width=80)
tree.column("stock", width=150)
tree.column("qty", width=60)
tree.column("buy", width=100)
tree.column("current", width=100)
tree.column("invest", width=100)
tree.column("profit", width=100)
cursor.execute("""
55
SELECT t.TransactionId, b.Name, s.StockId, s.StockName,
t.TransactionDate
FROM Transactions t
LIMIT 100
""")
"date"), show="headings")
tree.heading("buyer", text="Buyer")
tree.heading("stock", text="Stock")
tree.heading("type", text="Type")
tree.heading("qty", text="Qty")
tree.heading("price", text="Price")
tree.heading("amount", text="Amount")
56
tree.heading("date", text="Date")
tree.column("id", width=60)
tree.column("buyer", width=100)
tree.column("stockid", width=70)
tree.column("stock", width=120)
tree.column("type", width=70)
tree.column("qty", width=60)
tree.column("price", width=80)
tree.column("amount", width=90)
tree.column("date", width=120)
buyer_result = cursor.fetchone()
if buyer_result is None:
return
buyer_id = buyer_result[0]
cursor.execute("""
57
SELECT SUM(p.Quantity * p.PurchasePrice),
SUM(d.Amount),
b.Capital
FROM Portfolio p
WHERE p.BuyerId = %s
""", (buyer_id,))
investment = investment or 0
profit_loss = profit_loss or 0
dividends = dividends or 0
capital = capital or 0
side="left", padx=10)
58
tb.Label(summary_frame, text=f"Dividends: ₹{dividends:,.2f}",
font=("Helvetica", 10)).pack(side="left",
padx=10)
side="left", padx=10)
if view == "portfolio":
cursor.execute("""
p.PurchasePrice, s.Price,
FROM Portfolio p
WHERE p.BuyerId = %s
ORDER BY s.StockId
""", (buyer_id,))
show="headings")
59
tree.heading("id", text="Stock ID")
tree.heading("stock", text="Stock")
tree.heading("qty", text="Qty")
tree.heading("invest", text="Investment")
tree.heading("profit", text="P/L")
tree.column("id", width=80)
tree.column("stock", width=150)
tree.column("qty", width=60)
tree.column("buy", width=100)
tree.column("current", width=100)
tree.column("invest", width=100)
tree.column("profit", width=100)
cursor.execute("""
60
(t.Quantity * t.Price) AS Amount,
t.TransactionDate
FROM Transactions t
WHERE t.BuyerId = %s
""", (buyer_id,))
show="headings")
tree.heading("stock", text="Stock")
tree.heading("type", text="Type")
tree.heading("qty", text="Qty")
tree.heading("price", text="Price")
tree.heading("amount", text="Amount")
tree.heading("date", text="Date")
tree.column("id", width=60)
tree.column("stockid", width=70)
tree.column("stock", width=120)
61
tree.column("type", width=70)
tree.column("qty", width=60)
tree.column("price", width=80)
tree.column("amount", width=90)
tree.column("date", width=120)
# Add scrollbar
scrollbar.pack(side="right", fill="y")
tree.configure(yscrollcommand=scrollbar.set)
if view == "portfolio":
command=lambda: [win.destroy(),
open_portfolio_window(username, "transactions")],
62
bootstyle=INFO).pack(pady=10)
else:
command=lambda: [win.destroy(),
open_portfolio_window(username, "portfolio")],
bootstyle=INFO).pack(pady=10)
finally:
if 'cursor' in locals():
cursor.close()
if 'conn' in locals():
conn.close()
63
Chapter 8
OUTPUT SCREENSHOTS
8.1 Broker
64
Fig. 8.2 Login Confirmation of Broker
66
Fig. 8.6 Broker Actions for a Broker
67
8.2 Buyer
68
Fig. 8.10 Portfolio Page for Buyer
69
Fig. 8.12 Buy/Sell Stocks Page for Buyer
70
Chapter 9
RESULTS AND DISCUSSIONS
71
9.3 Discussion
The user-friendly interface ensures both investors and brokers can navigate and
interact with the system efficiently. The integration with MySQL ensures data
integrity and supports real-time updates for all market operations.
72
9.4 Security Measures
74
9.8 Future Enhancements
• Advanced Analytics:
Þ Predictive modeling for stock performance
Þ Portfolio optimization suggestions
Þ Risk assessment tools
• Mobile Integration:
Þ Native mobile apps for trading on the go
Þ Push notifications for price alerts and order execution
• AI Features:
Þ Intelligent order routing
Þ Fraud detection algorithms
Þ Personalized investment recommendations
• Blockchain Integration:
Þ Secure transaction recording
Þ Smart contracts for dividend distributions
Þ Tokenization of assets
• Extended Market Coverage:
Þ Support for additional asset classes (bonds, derivatives)
Þ International market integration
Þ Cryptocurrency trading capabilities
• Enhanced Risk Management:
Þ Real-time exposure monitoring
Þ Automated margin calls
Þ Circuit breaker implementations
• Social Trading Features:
Þ Investor community platform
Þ Copy trading functionality
Þ Performance sharing and benchmarking
75
Chapter 10
CONCLUSION
The stock management system provides a robust platform for securities trading
and portfolio management, with particular attention to concurrency control and
data integrity in financial operations. The system architecture successfully
addresses the challenges of high-volume transaction processing while
maintaining data consistency and system responsiveness.
76
Online Course Certificate
77
78
NPTEL Result Page
79
Scaler
80