File size: 2,364 Bytes
415516b
 
 
 
 
bd2ad8f
415516b
bd2ad8f
 
 
 
 
894490b
bd2ad8f
c8c6b46
 
bd2ad8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import streamlit as st
from aggregator import get_articles_sentiment

st.title("Real time financial news fast sentiment")

model_to_use = ""

model_selected = st.radio("Choose your model", ["fin_distilBert", "fin_tinyBert", "fin_miniLM"])

ticker = st.text_input("Insert the company ticker")

col1, col2 = st.columns(2)
if model_selected != None and ticker != None:

    st.write("You chose", model_selected)
    
    if model_selected == "fin_distilBert":
        model_to_use = "Andreagus/fin_distilbert_16"
    if model_selected == "fin_tinyBert":
        model_to_use = "Andreagus/fin_tinyBert_32"
    if model_selected == "fin_miniLM12":
        model_to_use = "Andreagus/fin_miniLM_16"

    results = get_articles_sentiment(ticker, model_to_use)
    
    with col1:
        st.text("Bezinga news provider")
        if results['bezinga']['bezinga_articles'] == 0:
            st.text('Bezinga returned 0 articles')
        else:
            st.json(results['bezinga'], expanded=False)

        st.text("finhub news provider")
        if results['finhub']['finhub_articles'] == 0:
            st.text('finhub returned 0 articles')
        else:
            st.json(results['finhub'], expanded=False)

        st.text("marketaux news provider")
        if results['marketaux']['marketaux_articles'] == 0:
            st.text('marketaux returned 0 articles')
        else:
            st.json(results['marketaux'], expanded=False)

        st.text("Newsapi news provider")
        if results['newsapi']['newsapi_articles'] == 0:
            st.text('newsapi returned 0 articles')
        else:
            st.json(results['newsapi'], expanded=False)

        st.text('Newsdata news provider')
        if results['newsdata']['newsdata_articles'] == 0:
            st.text('newsdata returned 0 articles')
        else:
            st.json(results['newsdata'], expanded=False)

        st.text("Vantage news provider")
        if results['vantage']['vantage_articles'] == 0:
            st.text('vantage returned 0 articles')
        else:
            st.json(results['vantage'], expanded=False)
    
    with col2:
        st.text("Summary results")
        st.metric("Total articles", results['total_articles'])
        st.metric("Total positive articles", results['total_positives'])
        st.metric("Total negative articles", results['total_negatives'])