Spaces:
Running
Running
Robert Castagna
commited on
Commit
·
52ae49b
1
Parent(s):
998ab98
upload app.py
Browse files- app.py +4 -0
- fin_data_api.py +4 -1
app.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
x = st.slider('Select a value')
|
4 |
+
st.write(x, 'squared is', x * x)
|
fin_data_api.py
CHANGED
@@ -13,7 +13,7 @@ def get_finnhub_data(example: str) -> json:
|
|
13 |
"""
|
14 |
Pass in the "example" string from the API documentation. It changes for every endpoint.
|
15 |
|
16 |
-
example: '/company-news?symbol=AAPL&from=2023-08-15&to=2023-08-20'
|
17 |
"""
|
18 |
base_url = 'https://finnhub.io/api/v1//'
|
19 |
token = f"&token={content['finhubapi_key']}"
|
@@ -25,10 +25,13 @@ def sentiment_analysis(headline:str) -> str:
|
|
25 |
"""
|
26 |
Pass in a headline and get back a sentiment analysis of the text.
|
27 |
This only works for one headline at a time; Should be expanded to work for a list of headlines.
|
|
|
|
|
28 |
"""
|
29 |
nlp = pipeline("sentiment-analysis")
|
30 |
return nlp(headline)
|
31 |
|
|
|
32 |
# get news articles for a company
|
33 |
res_news = get_finnhub_data('/company-news?symbol=AAPL&from=2023-08-15&to=2023-08-20')
|
34 |
#print(res_news[0].keys())
|
|
|
13 |
"""
|
14 |
Pass in the "example" string from the API documentation. It changes for every endpoint.
|
15 |
|
16 |
+
:param1 example: '/company-news?symbol=AAPL&from=2023-08-15&to=2023-08-20'
|
17 |
"""
|
18 |
base_url = 'https://finnhub.io/api/v1//'
|
19 |
token = f"&token={content['finhubapi_key']}"
|
|
|
25 |
"""
|
26 |
Pass in a headline and get back a sentiment analysis of the text.
|
27 |
This only works for one headline at a time; Should be expanded to work for a list of headlines.
|
28 |
+
|
29 |
+
:param1 headline: Text string: 'Apple is the best company in the world'
|
30 |
"""
|
31 |
nlp = pipeline("sentiment-analysis")
|
32 |
return nlp(headline)
|
33 |
|
34 |
+
|
35 |
# get news articles for a company
|
36 |
res_news = get_finnhub_data('/company-news?symbol=AAPL&from=2023-08-15&to=2023-08-20')
|
37 |
#print(res_news[0].keys())
|