0% found this document useful (0 votes)
12 views20 pages

Stock Trading App with User Login

The document outlines a Python application called TradeX, which is a trading platform that allows users to sign up, log in, and manage their stock portfolios. It includes features for buying and selling shares, viewing investment history, and generating invoices with QR codes. The application utilizes a MySQL database for user and transaction management, and it employs a graphical user interface built with Tkinter.

Uploaded by

himanegi1098
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views20 pages

Stock Trading App with User Login

The document outlines a Python application called TradeX, which is a trading platform that allows users to sign up, log in, and manage their stock portfolios. It includes features for buying and selling shares, viewing investment history, and generating invoices with QR codes. The application utilizes a MySQL database for user and transaction management, and it employs a graphical user interface built with Tkinter.

Uploaded by

himanegi1098
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import mysql.

connector

from tkinter import *

from tkinter import messagebox, ttk

import [Link] as plt

from [Link].backend_tkagg import FigureCanvasTkAgg

import qrcode

from PIL import Image, ImageTk

import os

def get_connection():

return [Link](

host='localhost',

user='root',

password='tiger',

database='stock_portfolio'

BG = '#181920'

FG = '#DCE3ED'

FONT = ('Arial', 12)

class TradingApp:

def __init__(self, root):

[Link] = root

[Link]('950x600')

[Link]('TradeX')

[Link](bg=BG)

[Link] = None

[Link] = None

if not [Link]('invoices'):

[Link]('invoices')
self.draw_home()

def clear(self):

for widget in [Link].winfo_children():

[Link]()

[Link](bg=BG)

def draw_home(self):

[Link]()

Label([Link], text='TradeX', font=('Arial', 28, 'bold'), fg=FG, bg=BG).pack(pady=14)

Button([Link], text="Sign Up", bg=BG, fg=FG, font=FONT, width=18,


command=self.draw_signup).pack(pady=16)

Button([Link], text="Log In", bg=BG, fg=FG, font=FONT, width=18,


command=self.draw_login).pack(pady=6)

def draw_signup(self):

[Link]()

Label([Link], text="Create an Account", font=FONT, fg=FG, bg=BG).pack(pady=8)

uname = Entry([Link], font=FONT, bg=BG, fg=FG)

[Link](pady=4)

[Link](0, "Username")

pwd = Entry([Link], font=FONT, show='*', bg=BG, fg=FG)

[Link](pady=4)

[Link](0, "Password")

def do_signup():

user, p = [Link](), [Link]()

if len(user)<3 or len(p)<3:

[Link]("Input Error", "Minimum 3 characters.")

return

try:

conn = get_connection(); cur = [Link]()

[Link]("INSERT INTO users (username, password) VALUES (%s, %s)", (user, p))
[Link](); [Link]()

[Link]("Success", "Account created!")

[Link] = self.get_userid(user, p)

[Link] = user

self.draw_user_home()

except [Link]:

[Link]("Error", "Username exists.")

Button([Link], text="Sign Up", bg=BG, fg=FG, font=FONT, width=14,


command=do_signup).pack(pady=8)

Button([Link], text="Back", bg=BG, fg=FG, font=FONT, width=14,


command=self.draw_home).pack()

def get_userid(self, username, password):

conn = get_connection(); cur = [Link]()

[Link]("SELECT userid FROM users WHERE username=%s AND password=%s", (username,


password))

r = [Link](); [Link]()

return r[0] if r else None

def draw_login(self):

[Link]()

Label([Link], text="Log In", font=FONT, fg=FG, bg=BG).pack(pady=8)

uname = Entry([Link], font=FONT, bg=BG, fg=FG)

[Link](pady=4)

[Link](0, "Username")

pwd = Entry([Link], font=FONT, show='*', bg=BG, fg=FG)

[Link](pady=4)

[Link](0, "Password")

def do_login():

uid = self.get_userid([Link](), [Link]())

if uid:

[Link] = uid
[Link] = [Link]()

self.draw_user_home()

else:

[Link]("Error", "Wrong username/password.")

Button([Link], text="Log In", bg=BG, fg=FG, font=FONT, width=14,


command=do_login).pack(pady=8)

Button([Link], text="Back", bg=BG, fg=FG, font=FONT, width=14,


command=self.draw_home).pack()

def draw_user_home(self):

[Link]()

Label([Link], text=f'Welcome, {[Link]}', font=('Arial', 19, 'bold'), fg=FG,


bg=BG).pack(pady=12)

nav = Frame([Link], bg=BG)

[Link](pady=5)

for (txt, cmd) in [

("My Investments", self.draw_investment_table),

("Buy Shares", self.risk_and_buy_flow),

("Sell Shares", self.draw_sell_flow),

("Transaction History", self.draw_history),

("Profit & Loss", self.draw_profitloss),

("Portfolio Chart", self.draw_piechart),

("Log Out", self.draw_home)

]:

Button(nav, text=txt, bg=BG, fg=FG, font=FONT, width=17, command=cmd).pack(side=LEFT,


padx=5)

def draw_investment_table(self):

[Link]()

Label([Link], text="Your Portfolio", font=('Arial', 17, 'bold'), fg=FG, bg=BG).pack(pady=8)


table = Frame([Link], bg=BG)

[Link](pady=20)

cols = ('Company', 'Type', 'Shares', 'Total Value')

tree = [Link](table, columns=cols, show='headings')

for col in cols:

[Link](col, text=col)

[Link](col, width=150)

conn = get_connection(); cur = [Link]()

[Link]("""

SELECT [Link], [Link], [Link], ROUND([Link]*[Link],2)

FROM holdings h JOIN companies c ON [Link] = [Link]

WHERE [Link] = %s

""", ([Link],))

for name, typ, qty, value in [Link]():

[Link]('', 'end', values=(name, typ, qty, value))

[Link]()

Button([Link], text="Back", bg=BG, fg=FG, font=FONT, width=10,


command=self.draw_user_home).pack(pady=12)

def risk_and_buy_flow(self):

[Link]()

Label([Link], text="Choose Risk", font=('Arial', 17, 'bold'), fg=FG, bg=BG).pack(pady=10)

risk_var = StringVar()

risk_var.set('high')

for text, value in [('High', 'high'), ('Moderate', 'moderate'), ('Low', 'low')]:

Radiobutton([Link], text=text, variable=risk_var, value=value, font=FONT, fg=FG, bg=BG,


selectcolor=BG).pack(anchor='w', padx=24, pady=6)

def proceed():

selected_risk = risk_var.get()

self.show_recommend_companies(selected_risk)

Button([Link], text="Next", bg=BG, fg=FG, font=FONT, width=14,


command=proceed).pack(pady=12)
Button([Link], text="Back", bg=BG, fg=FG, font=FONT, width=14,
command=self.draw_user_home).pack()

def show_recommend_companies(self, risk):

[Link]()

type_map = {'high': 'equity', 'moderate': 'preference', 'low': 'debenture'}

recommended_type = type_map[risk]

Label([Link], text=f"We are recommending you {recommended_type.title()} Shares.", fg=FG,


bg=BG, font=FONT).pack(pady=6)

Label([Link], text="Recommended Companies", font=('Arial', 17, 'bold'), fg=FG,


bg=BG).pack(pady=10)

conn = get_connection(); cur = [Link]()

[Link]("""

SELECT name, price, type FROM companies

WHERE risk=%s AND type=%s ORDER BY price DESC

""", (risk, recommended_type))

comps = [Link]()

if not comps:

Label([Link], text="No companies found.", fg='red', bg=BG, font=FONT).pack()

Button([Link], text="Back", bg=BG, fg=FG, font=FONT,


command=self.risk_and_buy_flow).pack()

return

for i, (name, price, typ) in enumerate(comps[:6]):

Label([Link], text=f"{i+1}. {name}, {typ}, ₹{price}", fg=FG, bg=BG, font=FONT).pack()

comp_var = StringVar(); comp_var.set(comps[0][0])

drop = OptionMenu([Link], comp_var, *[row[0] for row in comps[:6]])

[Link](bg=BG, fg=FG, font=FONT)

[Link]()

qty = Entry([Link], font=FONT, bg=BG, fg=FG)

[Link](pady=5); [Link](0,"Quantity")

def next_step():

self.draw_buy_page(comp_var.get(), [Link]())
Button([Link], text="Buy Now", bg=BG, fg=FG, font=FONT,
command=next_step).pack(pady=6)

Button([Link], text="Back", bg=BG, fg=FG, font=FONT,


command=self.risk_and_buy_flow).pack()

def draw_buy_page(self, company_name, qty_val):

[Link]()

conn = get_connection(); cur = [Link]()

[Link]("SELECT compid, price, type FROM companies WHERE name=%s",


(company_name,))

compid, price, typ = [Link]()

Label([Link], text=f"Buying {company_name} ({typ})", font=('Arial',16,'bold'), fg=FG,


bg=BG).pack(pady=8)

Label([Link], text=f"Price: ₹{price:.2f}", fg=FG, bg=BG, font=FONT).pack()

qty = int(qty_val) if qty_val.isdigit() and int(qty_val)>0 else 1

amount = qty*price*1.02

Label([Link], text=f"Total (2% comm): ₹{amount:.2f}", fg=FG, bg=BG, font=FONT).pack()

payment_var = StringVar(); payment_var.set('UPI')

drop = OptionMenu([Link], payment_var, 'UPI','Credit Card','Debit Card','Net Banking')

[Link](bg=BG, fg=FG, font=FONT)

[Link](pady=6)

cardno = Entry([Link], font=FONT, bg=BG, fg=FG)

# Dynamically show card entry for credit/debit

def update_card_field(*args):

if payment_var.get() in ['Credit Card','Debit Card']:

[Link](pady=3)

else:

cardno.pack_forget()

payment_var.trace_add('write', update_card_field)

def pay():
paym = payment_var.get()

card = None

if paym in ['Credit Card','Debit Card']:

card = [Link]()

if not [Link]() or len(card)!=16:

[Link]("Card Error","16 digits.")

return

conn2 = get_connection(); cur2 = [Link]()

[Link]("SELECT qty FROM holdings WHERE userid=%s AND compid=%s",([Link],


compid))

prev = [Link]()

new_qty = (prev[0] if prev else 0)+qty

if prev:

[Link]("UPDATE holdings SET qty=%s WHERE userid=%s AND compid=%s",


(new_qty,[Link],compid))

else:

[Link]("INSERT INTO holdings VALUES (%s,%s,%s)",([Link],compid,new_qty))

invoice_text = f"{[Link]} bought {qty} {company_name} for ₹{amount:.2f} ({paym})"

qr = [Link](invoice_text)

invoice_path = f"invoices/invoice_{[Link]}_{company_name}_{qty}.png"

[Link](invoice_path)

# Show QR after buying

top = Toplevel([Link])

[Link]("Payment Invoice (QR)")

img = [Link](invoice_path)

img = [Link]((220,220))

imgtk = [Link](img)

lbl = Label(top, text="Scan this QR for invoice", font=FONT)

[Link]()

panel = Label(top, image=imgtk)

[Link] = imgtk

[Link]()
[Link](3500, [Link])

[Link]("""INSERT INTO transactions

(userid, compid, qty, price, type, payment_method, card_no, invoice_path)

VALUES (%s,%s,%s,%s,'BUY',%s,%s,%s)""",

([Link], compid, qty, amount, paym, card, invoice_path))

[Link](); [Link]()

[Link]("Success", f"Bought!\nInvoice QR saved.")

self.draw_user_home()

Button([Link], text="Pay & Confirm", bg=BG, fg=FG, font=FONT,


command=pay).pack(pady=12)

Button([Link], text="Back", bg=BG, fg=FG, font=FONT,


command=self.risk_and_buy_flow).pack()

def draw_sell_flow(self):

[Link]()

Label([Link], text="Sell Your Shares", font=('Arial',16,'bold'), fg=FG, bg=BG).pack(pady=8)

conn = get_connection(); cur = [Link]()

[Link]("""

SELECT [Link], [Link], [Link], [Link] FROM holdings h JOIN companies c ON [Link] =
[Link]

WHERE [Link]=%s AND [Link]>0

""",([Link],))

holdings = [Link]()

if not holdings:

Label([Link], text="No shares to sell.", fg='red', bg=BG, font=FONT).pack()

Button([Link], text="Back", bg=BG, fg=FG, font=FONT,


command=self.draw_user_home).pack()

return

# Use compid as well as name to keep everything robust

compids = [row[0] for row in holdings]

choices = [f"{row[1]} ({row[3]})" for row in holdings]


comp_var = StringVar(); comp_var.set(choices[0])

drop = OptionMenu([Link], comp_var, *choices)

[Link](bg=BG, fg=FG, font=FONT)

[Link]()

qty = Entry([Link], font=FONT, bg=BG, fg=FG)

[Link](pady=5); [Link](0,"Quantity to Sell")

payment_var = StringVar(); payment_var.set('UPI')

drop2 = OptionMenu([Link], payment_var, 'UPI','Credit Card','Debit Card','Net Banking')

[Link](bg=BG, fg=FG, font=FONT)

[Link](pady=6)

cardno = Entry([Link], font=FONT, bg=BG, fg=FG)

# Dynamic card field

def update_card_field(*args):

if payment_var.get() in ['Credit Card','Debit Card']:

[Link](pady=3)

else:

cardno.pack_forget()

payment_var.trace_add('write', update_card_field)

def sell():

# Find the correct holding based on user's pick

selected_index = [Link](comp_var.get())

compid = compids[selected_index]

conn2 = get_connection(); cur2 = [Link]()

[Link]("SELECT name, price FROM companies WHERE compid=%s",(compid,))

result = [Link]()

if not result:

[Link]("Error", "Company not found in database.")

[Link]()

return
name, price = result

[Link]("SELECT qty FROM holdings WHERE userid=%s AND compid=%s",


([Link],compid))

prev = [Link]()

selqty = int([Link]()) if [Link]().isdigit() and int([Link]())>0 else 1

if prev and prev[0]>=selqty:

new_qty = prev[0]-selqty

[Link]("UPDATE holdings SET qty=%s WHERE userid=%s AND compid=%s",


(new_qty,[Link],compid))

amount = selqty*price*0.98

paym = payment_var.get()

card = None

if paym in ['Credit Card','Debit Card']:

card = [Link]()

if not [Link]() or len(card)!=16:

[Link]("Card Error","16 digits.")

[Link]();

return

invoice_text = f"{[Link]} sold {selqty} {name} for ₹{amount:.2f} ({paym})"

qr = [Link](invoice_text)

invoice_path = f"invoices/invoice_sell_{[Link]}_{name}_{selqty}.png"

[Link](invoice_path)

top = Toplevel([Link])

[Link]("Payment Invoice (QR)")

img = [Link](invoice_path)

img = [Link]((220,220))

imgtk = [Link](img)

lbl = Label(top, text="Scan this QR for invoice", font=FONT)

[Link]()

panel = Label(top, image=imgtk)

[Link] = imgtk

[Link]()
[Link](3500, [Link])

[Link]("""INSERT INTO transactions

(userid, compid, qty, price, type, payment_method, card_no, invoice_path)

VALUES (%s,%s,%s,%s,'SELL',%s,%s,%s)""",

([Link], compid, selqty, amount, paym, card, invoice_path))

[Link](); [Link]()

[Link]("Success", f"Sold!\nInvoice QR saved.")

self.draw_user_home()

else:

[Link]("Error", "Not enough shares to sell.")

[Link]()

Button([Link], text="Sell", bg=BG, fg=FG, font=FONT, command=sell).pack(pady=8)

Button([Link], text="Back", bg=BG, fg=FG, font=FONT,


command=self.draw_user_home).pack()

# Dynamically show card entry for credit/debit

def update_card_field(*args):

if payment_var.get() in ['Credit Card','Debit Card']:

[Link](pady=3)

else:

cardno.pack_forget()

payment_var.trace_add('write', update_card_field)

def sell():

sel = comp_var.get().split(' ')[0]

conn2 = get_connection(); cur2 = [Link]()

[Link]("SELECT compid, price FROM companies WHERE name=%s",(sel,))

compid, price = [Link]()

[Link]("SELECT qty FROM holdings WHERE userid=%s AND compid=%s",


([Link],compid))

prev = [Link]()

selqty = int([Link]()) if [Link]().isdigit() and int([Link]())>0 else 1


if prev and prev[0]>=selqty:

new_qty = prev[0]-selqty

[Link]("UPDATE holdings SET qty=%s WHERE userid=%s AND compid=%s",


(new_qty,[Link],compid))

amount = selqty*price*0.98

paym = payment_var.get()

card = None

if paym in ['Credit Card','Debit Card']:

card = [Link]()

if not [Link]() or len(card)!=16:

[Link]("Card Error","16 digits.")

[Link](); return

invoice_text = f"{[Link]} sold {selqty} {sel} for ₹{amount:.2f} ({paym})"

qr = [Link](invoice_text)

invoice_path = f"invoices/invoice_sell_{[Link]}_{sel}_{selqty}.png"

[Link](invoice_path)

# Show QR after selling

top = Toplevel([Link])

[Link]("Payment Invoice (QR)")

img = [Link](invoice_path)

img = [Link]((220,220))

imgtk = [Link](img)

lbl = Label(top, text="Scan this QR for invoice", font=FONT)

[Link]()

panel = Label(top, image=imgtk)

[Link] = imgtk

[Link]()

[Link](3500, [Link])

[Link]("""INSERT INTO transactions

(userid, compid, qty, price, type, payment_method, card_no, invoice_path)

VALUES (%s,%s,%s,%s,'SELL',%s,%s,%s)""",
([Link], compid, selqty, amount, paym, card, invoice_path))

[Link](); [Link]()

[Link]("Success", f"Sold!\nInvoice QR saved.")

self.draw_user_home()

else:

[Link]("Error", "Not enough shares to sell.")

[Link]()

Button([Link], text="Sell", bg=BG, fg=FG, font=FONT, command=sell).pack(pady=8)

Button([Link], text="Back", bg=BG, fg=FG, font=FONT,


command=self.draw_user_home).pack()

def draw_history(self):

[Link]()

Label([Link], text="Transaction History", font=('Arial',17,'bold'), fg=FG, bg=BG).pack(pady=8)

table = Frame([Link], bg=BG)

[Link](pady=12)

cols = ('Type','Company','Quantity','Amount','Date','Method','Invoice QR')

tree = [Link](table, columns=cols, show='headings')

for col in cols: [Link](col, text=col)

for col in cols: [Link](col, width=120)

conn = get_connection(); cur = [Link]()

[Link]("""

SELECT [Link], [Link], [Link], [Link], [Link], t.payment_method, t.invoice_path

FROM transactions t JOIN companies c ON [Link] = [Link]

WHERE [Link]=%s ORDER BY [Link] DESC

""", ([Link],))

for typ, name, qty, price, date, method, inv in [Link]():

[Link]('', 'end', values=(typ,name,qty,price,date,method,inv))

[Link]()

Button([Link], text="Back", bg=BG, fg=FG, font=FONT,


command=self.draw_user_home).pack(pady=8)
def draw_profitloss(self):

[Link]()

Label([Link], text="Profit / Loss", font=('Arial',17,'bold'), fg=FG, bg=BG).pack(pady=10)

conn = get_connection(); cur = [Link]()

[Link]("""

SELECT [Link],

SUM(CASE WHEN [Link]='SELL' THEN [Link] ELSE 0 END) -

SUM(CASE WHEN [Link]='BUY' THEN [Link] ELSE 0 END)

FROM transactions t

JOIN companies c ON [Link] = [Link]

WHERE [Link]=%s

GROUP BY [Link]

""", ([Link],))

for name, pl in [Link]():

Label([Link], text=f"{name}: ₹{pl if pl else 0:.2f}", fg=FG, bg=BG, font=FONT).pack()

Button([Link], text="Back", bg=BG, fg=FG, font=FONT,


command=self.draw_user_home).pack(pady=8)

def draw_piechart(self):

[Link]()

Label([Link], text="Portfolio Chart", font=('Arial',17,'bold'), fg=FG, bg=BG).pack(pady=10)

conn = get_connection(); cur = [Link]()

[Link]("""

SELECT type, SUM([Link]) FROM holdings h JOIN companies c ON [Link] = [Link]

WHERE [Link]=%s GROUP BY [Link]

""", ([Link],))

res = [Link]()

labels = [row[0] for row in res]

sizes = [row[1] for row in res]

colors = ['#4682B4','#FFD700','#32CD32']

fig, ax = [Link](figsize=(4,4), facecolor=BG)


[Link](sizes, labels=labels, colors=colors, autopct='%1.1f%%', textprops={'color':'white'})

canvas = FigureCanvasTkAgg(fig, master=[Link])

canvas.get_tk_widget().pack()

Button([Link], text="Back", bg=BG, fg=FG, font=FONT,


command=self.draw_user_home).pack(pady=10)

if __name__ == "__main__":

root = Tk()

app = TradingApp(root)

[Link]()
CREATE DATABASE stock_portfolio;

USE stock_portfolio;

CREATE TABLE users (

userid INT PRIMARY KEY AUTO_INCREMENT,

username VARCHAR(50) UNIQUE NOT NULL,

password VARCHAR(50) NOT NULL

);

CREATE TABLE companies (

compid INT PRIMARY KEY AUTO_INCREMENT,

name VARCHAR(50) UNIQUE NOT NULL,

price FLOAT NOT NULL,

risk ENUM('high', 'moderate', 'low') NOT NULL,

type ENUM('equity', 'preference', 'debenture') NOT NULL

);

CREATE TABLE holdings (

userid INT,

compid INT,

qty INT,

PRIMARY KEY (userid, compid)

);

CREATE TABLE transactions (

transid INT PRIMARY KEY AUTO_INCREMENT,

userid INT,

compid INT,

qty INT,

price FLOAT,

type ENUM('BUY','SELL'),
date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

payment_method VARCHAR(20),

card_no VARCHAR(20),

invoice_path VARCHAR(255)

);

INSERT INTO companies (name, price, risk, type) VALUES

('RELIANCE', 2800, 'high', 'equity'),

('TCS', 3500, 'high', 'equity'),

('INFY', 1500, 'moderate', 'equity'),

('HDFC BANK', 1700, 'moderate', 'equity'),

('BAJAJ FINSERV', 16300, 'high', 'preference'),

('ICICI BANK', 950, 'moderate', 'equity'),

('LARSEN & TOUBRO', 3750, 'moderate', 'equity'),

('HUL', 2550, 'low', 'equity'),

('KOTAK MAHINDRA', 1680, 'moderate', 'equity'),

('AXIS BANK', 1090, 'moderate', 'equity'),

('STATE BANK', 675, 'moderate', 'equity'),

('SUN PHARMA', 1220, 'moderate', 'equity'),

('ITC', 455, 'low', 'equity'),

('POWER GRID', 275, 'low', 'equity'),

('ONGC', 285, 'moderate', 'equity'),

('BHARTI AIRTEL', 950, 'high', 'equity'),

('MARUTI SUZUKI', 12200, 'moderate', 'equity'),

('TATA MOTORS', 920, 'high', 'equity'),

('ASIAN PAINTS', 3120, 'moderate', 'equity'),

('NTPC', 320, 'low', 'equity'),

('HCL TECH', 1500, 'moderate', 'equity'),

('ULTRATECH CEMENT', 9800, 'high', 'equity'),

('NESTLE INDIA', 24200, 'low', 'equity'),

('JSW STEEL', 895, 'high', 'equity'),


('HINDALCO', 580, 'high', 'equity'),

('WIPRO', 460, 'moderate', 'equity'),

('GRASIM', 2400, 'moderate', 'equity'),

('BAJAJ AUTO', 8500, 'moderate', 'equity'),

('PIDILITE', 3000, 'low', 'equity'),

('COAL INDIA', 375, 'moderate', 'equity'),

('ADANI ENTERPRISES', 2250, 'high', 'equity'),

('ADANI PORTS', 1400, 'moderate', 'equity'),

('DIVIS LABS', 3550, 'moderate', 'equity'),

('DABUR', 590, 'low', 'equity'),

('SYNGENE', 720, 'moderate', 'equity'),

('INDUSIND BANK', 1420, 'moderate', 'equity'),

('TITAN', 3700, 'low', 'equity'),

('EICHER MOTORS', 4050, 'high', 'equity'),

('BRITANNIA', 5650, 'low', 'equity'),

('SHREE CEMENT', 29000, 'high', 'equity'),

('TATA STEEL', 130, 'high', 'equity'),

('DR REDDY', 5900, 'moderate', 'equity'),

('BAJAJ FINANCE', 7300, 'high', 'preference'),

('HDFC LIFE', 635, 'moderate', 'preference'),

('ICICI PRU LIFE', 560, 'moderate', 'preference'),

('SBI LIFE', 1520, 'moderate', 'preference'),

('LIC HOUSING', 650, 'moderate', 'preference'),

('INDIABULLS HOUSING', 220, 'high', 'preference'),

('YES BANK', 22, 'high', 'preference'),

('PNB', 89, 'moderate', 'preference');

INSERT INTO companies (name, price, risk, type) VALUES

('MAHINDRA FINANCE', 1024, 'moderate', 'debenture'),

('STATE BANK OF INDIA', 1003, 'low', 'debenture'),

('PATEL ENGINEERING', 1000, 'high', 'debenture'),

('ICICI BANK', 991, 'moderate', 'debenture'),


('HDB FINANCIAL', 1024, 'moderate', 'debenture'),

('CHOLAMANDALAM FINANCE', 1023, 'moderate', 'debenture'),

('UGRO CAPITAL', 991, 'high', 'debenture'),

('NUVAMA WEALTH FINANCE', 1028, 'high', 'debenture'),

('NAVI FINSERV', 998, 'high', 'debenture'),

('PIRAMAL FINANCE', 933, 'high', 'debenture'),

('KERALA INFRA FUND', 1000, 'moderate', 'debenture'),

('OXYZO FINANCIAL', 991, 'high', 'debenture'),

('CLIX CAPITAL', 998, 'high', 'debenture'),

('AUXILO FINSERVE', 982, 'moderate', 'debenture'),

('INCRED FINANCIAL', 995, 'high', 'debenture'),

('IIFL FINANCE', 991, 'high', 'debenture'),

('KRAZYBEE SERVICES', 988, 'high', 'debenture'),

('U.P. POWER CORPORATION', 1056, 'moderate', 'debenture'),

('VIVRITI CAPITAL', 1001, 'high', 'debenture'),

('THE ANDHRA PRADESH MINERAL DEV CORP', 1037, 'moderate', 'debenture');

You might also like