-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
108 lines (76 loc) · 3.24 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Imports
import PyQt5.QtWidgets as qtw
import PyQt5.QtGui as qtg
import stock
#
class MainWindow(qtw.QWidget):
def __init__(self):
super().__init__()
# Add title
self.setWindowTitle("Stock Screener")
# Set layout
form_layout = qtw.QFormLayout()
self.setLayout(form_layout)
# Title label
title_label = qtw.QLabel("Stock Screener")
title_label.setFont(qtg.QFont('Helvetica', 18)) # Change font
self.layout().addWidget(title_label)
# Stock Code Entry Box
code_entry = qtw.QLineEdit()
code_entry.setObjectName("code_input")
self.layout().addWidget(code_entry)
# Text Outputs
name_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(name_output)
cap_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(cap_output)
cap_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(cap_output)
debt_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(debt_output)
peRatio_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(peRatio_output)
eps_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(eps_output)
cash_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(cash_output)
borrowings_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(borrowings_output)
shEquity_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(shEquity_output)
profit_output = qtw.QTextEdit(self, readOnly = True)
self.layout().addWidget(profit_output)
# Submit Button
submitButton = qtw.QPushButton("Submit", clicked = lambda: submitButtonClick())
self.layout().addWidget(submitButton)
# Row Allocation
form_layout.addRow(title_label)
form_layout.addRow("Enter Company Code: ", code_entry)
form_layout.addRow("Name", name_output)
form_layout.addRow("MCap", cap_output)
form_layout.addRow("Debt", debt_output)
form_layout.addRow("PE Ratio", peRatio_output)
form_layout.addRow("EPS", eps_output)
form_layout.addRow("Cash", cash_output)
form_layout.addRow("Borrowings", borrowings_output)
form_layout.addRow("SH Equity", shEquity_output)
form_layout.addRow("Profit", profit_output)
form_layout.addRow(submitButton)
self.show()
# Define functions after show()
def submitButtonClick():
code = code_entry.text()
newStock = stock.Stock(code)
name_output.setText(newStock.name)
cap_output.setText(str(newStock.cap))
debt_output.setText(str(newStock.debt))
peRatio_output.setText(str(newStock.peRatio))
eps_output.setText(str(newStock.eps))
cash_output.setText(str(newStock.cash))
shEquity_output.setText(str(newStock.shareholder_equity))
profit_output.setText(str(newStock.annual_profits))
newStock.assessStock()
print(newStock.score)
app = qtw.QApplication([])
mw = MainWindow()
app.exec_()