-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.py
63 lines (48 loc) · 1.56 KB
/
common.py
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
import streamlit as st
def common_styles():
st.set_page_config(layout="wide")
common_styles = """
<style>
#MainMenu,
footer
{visibility: hidden; !important}
</style>
"""
st.markdown(common_styles, unsafe_allow_html=True)
def display_backup_missing():
st.error("Local backup not available; check for latest online version", icon="⚠️")
config = dict(
doubleClickDelay = 400, # (ms) affects the single click delay; default = 300ms
displayModeBar = False,
displaylogo = False,
showTips = False
)
def sidebar():
if "symbol" not in st.session_state:
st.session_state["symbol"] = "TITAN.NS"
st.session_state["symbol"] = st.sidebar.text_input(
"Ticker Symbol",
value = "TITAN.NS"
)
if "online" not in st.session_state:
st.session_state["online"] = False
if "frequency" not in st.session_state:
st.session_state["frequency"] = "Annual"
st.session_state["online"] = True # st.sidebar.checkbox("Latest?", False)
st.session_state["asynchronous"] = True
asynchronous_str = "" if not st.session_state["asynchronous"] else ", asynchronous=True"
st.session_state["formatted"] = False
formatted_str = "" if not st.session_state["formatted"] else ", formatted=True"
st.session_state["tickers"] = init_ticker(
st.session_state["symbol"],
formatted=st.session_state["formatted"],
asynchronous=st.session_state["asynchronous"]
)
st.session_state["strings"] = {
'formatted_str': formatted_str,
'asynchronous_str': asynchronous_str
}
from yahooquery import Ticker
#@st.cache_data
def init_ticker(symbol, **kwargs):
return Ticker(symbol, **kwargs)