diff --git a/main.py b/main.py index 8f4d88f..ef1159b 100644 --- a/main.py +++ b/main.py @@ -1,125 +1,49 @@ import streamlit as st -import yaml -from st_pages import Page, Section, show_pages -from yaml import SafeLoader -import streamlit_authenticator as stauth -from CONFIG import AUTH_SYSTEM_ENABLED +from frontend.st_utils import auth_system -def main_page(): - show_pages( - [ - Page("main.py", "Hummingbot Dashboard", "๐Ÿ“Š"), - Section("Bot Orchestration", "๐Ÿ™"), - Page("frontend/pages/orchestration/instances/app.py", "Instances", "๐Ÿฆ…"), - Page("frontend/pages/orchestration/launch_bot_v2/app.py", "Deploy V2", "๐Ÿš€"), - Page("frontend/pages/orchestration/credentials/app.py", "Credentials", "๐Ÿ”‘"), - Page("frontend/pages/orchestration/portfolio/app.py", "Portfolio", "๐Ÿ’ฐ"), - # Page("frontend/pages/orchestration/launch_bot_v2_st/app.py", "Deploy ST", "๐Ÿ™Œ"), - # Page("pages/file_manager/app.py", "File Explorer", "๐Ÿ—‚"), - Section("Config Generator", "๐ŸŽ›๏ธ"), - Page("frontend/pages/config/pmm_simple/app.py", "PMM Simple", "๐Ÿ‘จโ€๐Ÿซ"), - Page("frontend/pages/config/pmm_dynamic/app.py", "PMM Dynamic", "๐Ÿ‘ฉโ€๐Ÿซ"), - Page("frontend/pages/config/dman_maker_v2/app.py", "D-Man Maker V2", "๐Ÿค–"), - Page("frontend/pages/config/bollinger_v1/app.py", "Bollinger V1", "๐Ÿ“ˆ"), - Page("frontend/pages/config/macd_bb_v1/app.py", "MACD_BB V1", "๐Ÿ“Š"), - Page("frontend/pages/config/supertrend_v1/app.py", "SuperTrend V1", "๐Ÿ‘จโ€๐Ÿ”ฌ"), - Page("frontend/pages/config/xemm_controller/app.py", "XEMM Controller", "โšก๏ธ"), - # Page("frontend/pages/config/position_builder/app.py", "Position Builder", "๐Ÿ”ญ"), - Section("Data", "๐Ÿ’พ"), - Page("frontend/pages/data/download_candles/app.py", "Download Candles", "๐Ÿ’น"), - # Page("pages/create/create.py", "Create", "โš”๏ธ"), - # Page("pages/optimize/optimize.py", "Optimize", "๐Ÿงช"), - # Page("pages/analyze/analyze.py", "Analyze", "๐Ÿ”ฌ"), - Section("Community Pages", "๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ"), - # Page("frontend/pages/performance/strategy_performance/app.py", "Strategy Performance", "๐Ÿš€"), - Page("frontend/pages/data/token_spreads/app.py", "Token Spreads", "๐Ÿง™"), - Page("frontend/pages/data/tvl_vs_mcap/app.py", "TVL vs Market Cap", "๐Ÿฆ‰"), - ] - ) - - # Readme Section - readme_container = st.container() - with readme_container: - st.markdown("# ๐Ÿ“Š Hummingbot Dashboard") +def main(): + # readme section + with st.container(): + st.markdown("# ๐Ÿ“Š hummingbot dashboard") st.markdown(""" - Hummingbot Dashboard is an open source application that helps you create, backtest, and optimize various - types of algo trading strategies. Afterwards, you can deploy them as [Hummingbot](http://hummingbot.org) + hummingbot dashboard is an open source application that helps you create, backtest, and optimize various + types of algo trading strategies. afterwards, you can deploy them as [hummingbot](http://hummingbot.org) instances in either paper or live trading mode.""") - st.write("---") - - st.header("Getting Started") - - st.write( - "Watch the [Hummingbot Dashboard Tutorial playlist](https://www.youtube.com/watch?v=a-kenMqRB00) to get started!") - - # Container for the videos - container = st.container() - + st.header("Getting started") + st.write("watch the [hummingbot dashboard tutorial playlist](https://www.youtube.com/watch?v=a-kenmqrb00) to get started!") video_titles = [ - "1 - Introduction to Dashboard", - "2 - Setting up the Environment", - "3 - Managing Credentials", - "4 - Using the Master Bot Profile", - "5 - Deploying Bots and Running Strategies", - "7 - Controllers, Backtesting, and Optimization", - "8 - Deploying Best Strategies from Backtests", - "9 - Conclusions and Next Steps" + "1 - introduction to dashboard", + "2 - setting up the environment", + "3 - managing credentials", + "4 - using the master bot profile", + "5 - deploying bots and running strategies", + "7 - controllers, backtesting, and optimization", + "8 - deploying best strategies from backtests", + "9 - conclusions and next steps" ] - # List of YouTube video links + # list of youtube video links video_links = [ - "https://www.youtube.com/embed/a-kenMqRB00", - "https://www.youtube.com/embed/AbezIhb6iJg", - "https://www.youtube.com/embed/VmlD_WQVe4M", - "https://www.youtube.com/embed/MPQTnlDXPno", - "https://www.youtube.com/embed/915E-C2LWdg", - "https://www.youtube.com/embed/bAi2ok7_boo", - "https://www.youtube.com/embed/BJf3ml-9JIQ", - "https://www.youtube.com/embed/ug_SSZb2HYE", + "https://www.youtube.com/embed/a-kenmqrb00", + "https://www.youtube.com/embed/abezihb6ijg", + "https://www.youtube.com/embed/vmld_wqve4m", + "https://www.youtube.com/embed/mpqtnldxpno", + "https://www.youtube.com/embed/915e-c2lwdg", + "https://www.youtube.com/embed/bai2ok7_boo", + "https://www.youtube.com/embed/bjf3ml-9jiq", + "https://www.youtube.com/embed/ug_sszb2hye", ] + # ensure the lists have the same length + assert len(video_titles) == len(video_links), "mismatch between titles and links." + with st.container(): + video_selection = st.selectbox("choose a video:", options=video_titles) + selected_index = video_titles.index(video_selection) + st.video(video_links[selected_index]) + st.write("---") + st.header("feedback and issues") + st.write("please give us feedback in the **#dashboard** channel of the [hummingbot discord](https://discord.gg/hummingbot)! ๐Ÿ™") + st.write("if you encounter any bugs or have suggestions for improvement, please create an issue in the [hummingbot dashboard github](https://github.com/hummingbot/dashboard).") - # Ensure the lists have the same length - assert len(video_titles) == len(video_links), "Mismatch between titles and links." - - # Create a carousel-like feature - video_selection = st.selectbox("Choose a video:", options=video_titles) - - # Get the index of the selected video title - selected_index = video_titles.index(video_selection) - - # Display the selected video - st.video(video_links[selected_index]) - - st.write("---") - - st.header("Feedback and Issues") - - st.write("Please give us feedback in the **#dashboard** channel of the [Hummingbot Discord](https://discord.gg/hummingbot)! ๐Ÿ™") - - st.write("If you encounter any bugs or have suggestions for improvement, please create an issue in the [Hummingbot Dashboard Github](https://github.com/hummingbot/dashboard).") - - -if not AUTH_SYSTEM_ENABLED: - main_page() -else: - with open('credentials.yml') as file: - config = yaml.load(file, Loader=SafeLoader) - authenticator = stauth.Authenticate( - config['credentials'], - config['cookie']['name'], - config['cookie']['key'], - config['cookie']['expiry_days'], - config['pre-authorized'] - ) - authenticator.login() - if st.session_state["authentication_status"]: - authenticator.logout(location="sidebar") - st.sidebar.write(f'Welcome *{st.session_state["name"]}*') - main_page() - else: - show_pages([Page("main.py", "Hummingbot Dashboard", "๐Ÿ“Š"),]) - if st.session_state["authentication_status"] is False: - st.error('Username/password is incorrect') - elif st.session_state["authentication_status"] is None: - st.warning('Please enter your username and password') \ No newline at end of file +auth_system() +main()