niyaa commited on
Commit
f20226d
1 Parent(s): 3eac012

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -27
app.py CHANGED
@@ -6,45 +6,43 @@ import datetime
6
 
7
  # App title
8
  st.markdown('''
9
- # Stock Price App
10
- Shown are the stock price data for query companies!
11
 
12
  **Credits**
13
- - App built by [Chanin Nantasenamat](https://medium.com/@chanin.nantasenamat) (aka [Data Professor](http://youtube.com/dataprofessor))
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(2021, 1, 31))
22
 
23
- # Retrieving tickers data
24
- ticker_list = pd.read_csv('https://raw.githubusercontent.com/dataprofessor/s-and-p-500-companies/master/data/constituents_symbols.txt')
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
- string_name = tickerData.info['longName']
32
- st.header('**%s**' % string_name)
33
 
34
- string_summary = tickerData.info['longBusinessSummary']
35
- st.info(string_summary)
 
36
 
37
- # Ticker data
38
- st.header('**Ticker data**')
39
- st.write(tickerDf)
 
 
 
 
 
40
 
41
- # Bollinger bands
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