⚠
️ DEPRECATED GITLAB INSTANCE
⚠
️ This GitLab is now read-only for reference. Please use
https://gitlab.iauro.co
for all new work.
Migration completed on September 17, 2025
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Gen AI Assignment
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages
Packages
Container Registry
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mitul Lakkad
Gen AI Assignment
Commits
bdcd0b09
Commit
bdcd0b09
authored
Jun 03, 2025
by
pragati-siddhiinfosoft
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stock list and stock data updated
parent
be57f5f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
26 deletions
+41
-26
streamlit_stock_app/app.py
streamlit_stock_app/app.py
+41
-26
No files found.
streamlit_stock_app/app.py
View file @
bdcd0b09
...
...
@@ -5,14 +5,10 @@ from sumy.parsers.plaintext import PlaintextParser
from
sumy.nlp.tokenizers
import
Tokenizer
from
sumy.summarizers.lsa
import
LsaSummarizer
# --------------------------------
# Page configuration
# --------------------------------
st
.
set_page_config
(
page_title
=
"Stock Dashboard & Summarizer"
,
layout
=
"wide"
)
# --------------------------------
# App Title and Description
# --------------------------------
st
.
title
(
"📈 Stock Price Dashboard & 📝 Summarizer"
)
st
.
markdown
(
"""
Welcome to the **Stock Analysis App** built with Streamlit.
...
...
@@ -20,38 +16,59 @@ Welcome to the **Stock Analysis App** built with Streamlit.
- Paste stock-related news or description for **automatic summarization**
"""
)
# --------------------------------
# User Input Section
# --------------------------------
st
.
sidebar
.
header
(
"User Input"
)
stock_symbol
=
st
.
sidebar
.
text_input
(
"Enter Stock Symbol (e.g., AAPL, MSFT)"
,
value
=
"AAPL"
)
stock_symbols
=
st
.
sidebar
.
multiselect
(
"Select Stock Symbols"
,
[
"AAPL"
,
"MSFT"
,
"GOOGL"
,
"AMZN"
,
"META"
,
"TSLA"
,
"NVDA"
,
"JPM"
,
"V"
,
"WMT"
,
"JSWSTEEL.NS"
],
default
=
[
"AAPL"
]
)
days
=
st
.
sidebar
.
slider
(
"Select number of past days"
,
min_value
=
5
,
max_value
=
365
,
value
=
30
)
# --------------------------------
# Function to fetch stock data
# --------------------------------
@
st
.
cache_data
def
fetch_stock_data
(
symbol
,
days
):
return
yf
.
download
(
symbol
,
period
=
f
"{days}d"
)
try
:
data
=
yf
.
download
(
symbol
,
period
=
f
"{days}d"
)
return
data
except
Exception
as
e
:
return
None
def
display_stock_chart
(
stock_data
,
symbol
,
use_full_width
=
False
):
if
use_full_width
:
st
.
subheader
(
f
"{symbol} Stock Price"
)
st
.
line_chart
(
stock_data
[
'Close'
],
use_container_width
=
True
)
latest_price
=
float
(
stock_data
[
'Close'
]
.
iloc
[
-
1
])
st
.
metric
(
f
"{symbol} Latest Close Price"
,
f
"${latest_price:.2f}"
)
else
:
with
col1
if
idx
%
2
==
0
else
col2
:
st
.
subheader
(
f
"{symbol} Stock Price"
)
st
.
line_chart
(
stock_data
[
'Close'
],
use_container_width
=
True
)
latest_price
=
float
(
stock_data
[
'Close'
]
.
iloc
[
-
1
])
st
.
metric
(
f
"{symbol} Latest Close Price"
,
f
"${latest_price:.2f}"
)
# --------------------------------
# Display stock chart
# --------------------------------
st
.
subheader
(
f
"📊 Stock Price Chart for {stock_symbol}"
)
st
.
subheader
(
f
"📊 Stock Price Charts"
)
if
st
.
sidebar
.
button
(
"Load Stock Data"
):
try
:
stock_data
=
fetch_stock_data
(
stock_symbol
,
days
)
if
not
stock_data
.
empty
:
st
.
line_chart
(
stock_data
[
'Close'
])
st
.
metric
(
"Latest Close Price"
,
f
"${stock_data['Close'].iloc[-1]:.2f}"
)
else
:
st
.
warning
(
"No data found for this symbol."
)
except
Exception
as
e
:
st
.
error
(
f
"Error fetching data: {e}"
)
total_stocks
=
len
(
stock_symbols
)
# For multiple stocks, create two columns
if
total_stocks
>
1
:
col1
,
col2
=
st
.
columns
(
2
)
for
idx
,
symbol
in
enumerate
(
stock_symbols
):
try
:
stock_data
=
fetch_stock_data
(
symbol
,
days
)
if
stock_data
is
not
None
and
not
stock_data
.
empty
:
# Use full width for single stock or last stock in odd number
use_full_width
=
total_stocks
==
1
or
(
idx
==
total_stocks
-
1
and
total_stocks
%
2
==
1
)
display_stock_chart
(
stock_data
,
symbol
,
use_full_width
)
else
:
st
.
warning
(
f
"No data found for symbol {symbol}."
)
except
Exception
as
e
:
st
.
error
(
f
"Error fetching data for {symbol}: {str(e)}"
)
# --------------------------------
# Text Summarization Section
# --------------------------------
st
.
markdown
(
"---"
)
st
.
subheader
(
"📝 Stock News or Description Summarizer"
)
text_input
=
st
.
text_area
(
"Paste any stock-related text here to summarize"
)
...
...
@@ -72,8 +89,6 @@ if st.button("Generate Summary"):
else
:
st
.
warning
(
"Please enter some text first."
)
# --------------------------------
# Footer
# --------------------------------
st
.
markdown
(
"---"
)
st
.
markdown
(
"Built with [Streamlit](https://streamlit.io/) | By Mitul Lakkad"
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment