niyaa commited on
Commit
99561e6
1 Parent(s): f06bf00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -14
app.py CHANGED
@@ -1,21 +1,52 @@
1
  import streamlit as st
2
- from transformers import pipeline
3
- import torch
4
- from transformers import AutoTokenizer, AutoModelForSequenceClassification
5
-
6
  import datetime
7
- import streamlit as st
8
 
9
- #d = st.date_input("Chose the Date for which you are interested in", value=None)
10
- #st.write('You selected:', d)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
- tokenizer = AutoTokenizer.from_pretrained("nickmuchi/sec-bert-finetuned-finance-classification")
13
- model = AutoModelForSequenceClassification.from_pretrained("nickmuchi/sec-bert-finetuned-finance-classification")
14
 
 
 
 
15
 
16
- pipe = pipeline("text-classification", model=model, tokenizer=tokenizer, device=device)
17
- text = st.text_area("Enter some text")
 
 
 
 
18
 
19
- if text:
20
- out = pipe(text)
21
- st.json(out)
 
1
  import streamlit as st
2
+ import yfinance as yf
3
+ import pandas as pd
4
+ import cufflinks as cf
 
5
  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
+ # Ticker information
30
+ string_logo = '<img src=%s>' % tickerData.info['logo_url']
31
+ st.markdown(string_logo, unsafe_allow_html=True)
32
+
33
+ string_name = tickerData.info['longName']
34
+ st.header('**%s**' % string_name)
35
 
36
+ string_summary = tickerData.info['longBusinessSummary']
37
+ st.info(string_summary)
38
 
39
+ # Ticker data
40
+ st.header('**Ticker data**')
41
+ st.write(tickerDf)
42
 
43
+ # Bollinger bands
44
+ st.header('**Bollinger Bands**')
45
+ qf=cf.QuantFig(tickerDf,title='First Quant Figure',legend='top',name='GS')
46
+ qf.add_bollinger_bands()
47
+ fig = qf.iplot(asFigure=True)
48
+ st.plotly_chart(fig)
49
 
50
+ ####
51
+ #st.write('---')
52
+ #st.write(tickerData.info)