Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,45 +6,43 @@ import datetime
|
|
6 |
|
7 |
# App title
|
8 |
st.markdown('''
|
9 |
-
#
|
10 |
-
Shown are the stock price data for
|
11 |
|
12 |
**Credits**
|
13 |
-
- App built by
|
14 |
-
- Built in `Python` using `streamlit`,`yfinance`, `cufflinks`, `pandas` and `datetime`
|
15 |
''')
|
16 |
st.write('---')
|
17 |
|
18 |
# Sidebar
|
19 |
st.sidebar.subheader('Query parameters')
|
20 |
start_date = st.sidebar.date_input("Start date", datetime.date(2019, 1, 1))
|
21 |
-
end_date = st.sidebar.date_input("End date", datetime.date(
|
22 |
|
23 |
-
#
|
24 |
-
|
25 |
-
tickerSymbol = st.sidebar.selectbox('Stock ticker', ticker_list) # Select ticker symbol
|
26 |
-
tickerData = yf.Ticker(tickerSymbol) # Get ticker data
|
27 |
-
tickerDf = tickerData.history(period='1d', start=start_date, end=end_date) #get the historical prices for this ticker
|
28 |
|
|
|
|
|
|
|
29 |
|
|
|
|
|
30 |
|
31 |
-
|
32 |
-
st.
|
33 |
|
34 |
-
|
35 |
-
st.
|
|
|
36 |
|
37 |
-
#
|
38 |
-
st.header('**
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
#
|
42 |
-
st.header('**Bollinger Bands**')
|
43 |
-
qf=cf.QuantFig(tickerDf,title='First Quant Figure',legend='top',name='GS')
|
44 |
-
qf.add_bollinger_bands()
|
45 |
-
fig = qf.iplot(asFigure=True)
|
46 |
-
st.plotly_chart(fig)
|
47 |
-
|
48 |
-
####
|
49 |
-
#st.write('---')
|
50 |
-
#st.write(tickerData.info)
|
|
|
6 |
|
7 |
# App title
|
8 |
st.markdown('''
|
9 |
+
# Sovrenn Market Sentiment Indicator App
|
10 |
+
Shown are the stock price data for the selected company!
|
11 |
|
12 |
**Credits**
|
13 |
+
- App built by SRL
|
|
|
14 |
''')
|
15 |
st.write('---')
|
16 |
|
17 |
# Sidebar
|
18 |
st.sidebar.subheader('Query parameters')
|
19 |
start_date = st.sidebar.date_input("Start date", datetime.date(2019, 1, 1))
|
20 |
+
end_date = st.sidebar.date_input("End date", datetime.date(2023, 9, 30))
|
21 |
|
22 |
+
# User input for the stock ticker symbol
|
23 |
+
tickerSymbol = "^NSEI"
|
|
|
|
|
|
|
24 |
|
25 |
+
if tickerSymbol:
|
26 |
+
tickerData = yf.Ticker(tickerSymbol) # Get ticker data
|
27 |
+
tickerDf = tickerData.history(period='1d', start=start_date, end=end_date) # Get the historical prices for this ticker
|
28 |
|
29 |
+
string_name = tickerData.info['longName']
|
30 |
+
st.header('**%s**' % string_name)
|
31 |
|
32 |
+
string_summary = tickerData.info['longBusinessSummary']
|
33 |
+
st.info(string_summary)
|
34 |
|
35 |
+
# Ticker data
|
36 |
+
st.header('**Ticker data**')
|
37 |
+
st.write(tickerDf)
|
38 |
|
39 |
+
# Bollinger bands
|
40 |
+
st.header('**Bollinger Bands**')
|
41 |
+
qf = cf.QuantFig(tickerDf, title='First Quant Figure', legend='top', name='GS')
|
42 |
+
qf.add_bollinger_bands()
|
43 |
+
fig = qf.iplot(asFigure=True)
|
44 |
+
st.plotly_chart(fig)
|
45 |
+
else:
|
46 |
+
st.warning("Please enter a valid Stock Ticker Symbol.")
|
47 |
|
48 |
+
# You can remove the code for displaying the S&P 500 company symbols and information
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|