-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (44 loc) · 1.4 KB
/
Copy pathmain.py
File metadata and controls
50 lines (44 loc) · 1.4 KB
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
import streamlit as st
from db import initialize_database
from ui import (
auth_ui, bank_ui, portfolio_ui,
transactions_ui, sell_ui,
live_prices_ui, recommendation_ui
)
def rerun_app():
try:
st.experimental_rerun()
except AttributeError:
try:
st.rerun()
except AttributeError:
st.warning("Unable to rerun app automatically. Please refresh the page manually.")
def main():
initialize_database()
st.title("CRYPT EXCHANGE")
if 'user_id' not in st.session_state:
auth_ui.main()
else:
menu = st.sidebar.selectbox(
"Navigate",
["Bank", "Portfolio", "Trade", "Live Prices", "Recommendations", "Logout"]
)
if menu == "Bank":
bank_ui.main()
elif menu == "Portfolio":
portfolio_ui.main()
elif menu == "Trade":
trade_action = st.sidebar.selectbox("Trade Options", ["Buy", "Sell"])
if trade_action == "Buy":
transactions_ui.main()
else:
sell_ui.main()
elif menu == "Live Prices":
live_prices_ui.main()
elif menu == "Recommendations":
recommendation_ui.main()
elif menu == "Logout":
st.session_state.pop('user_id')
rerun_app()
if __name__ == "__main__":
main()