import random
from datetime import datetime, timedelta
import pandas as pd
import plotly.graph_objects as go
import streamlit as st
from frontend.st_utils import initialize_st_page
initialize_st_page(
layout="wide",
show_readme=False
)
# Custom CSS for enhanced styling
st.markdown("""
""", unsafe_allow_html=True)
# Hero Section
st.markdown("""
๐ค Hummingbot Dashboard
Your Command Center for Algorithmic Trading Excellence
""", unsafe_allow_html=True)
# Generate sample data for demonstration
def generate_sample_data():
"""Generate sample trading data for visualization"""
dates = pd.date_range(start=datetime.now() - timedelta(days=30), end=datetime.now(), freq='D')
# Sample portfolio performance
portfolio_values = []
base_value = 10000
for i in range(len(dates)):
change = random.uniform(-0.02, 0.03) # -2% to +3% daily change
base_value *= (1 + change)
portfolio_values.append(base_value)
return pd.DataFrame({
'date': dates,
'portfolio_value': portfolio_values,
'daily_return': [random.uniform(-0.05, 0.08) for _ in range(len(dates))]
})
# Quick Stats Dashboard
st.markdown("## ๐ Live Dashboard Overview")
# Mock data warning
st.warning("""
โ ๏ธ **Demo Data Notice**: The metrics, charts, and statistics shown below are simulated/mocked data for demonstration purposes.
This showcases how real trading data would be presented in the dashboard once connected to live trading bots.
""")
col1, col2, col3, col4 = st.columns(4)
with col1:
st.markdown("""
๐ Active Bots
3
Currently Trading
""", unsafe_allow_html=True)
with col2:
st.markdown("""
๐ฐ Total Portfolio
$12,847
+2.3% Today
""", unsafe_allow_html=True)
with col3:
st.markdown("""
๐ Win Rate
74.2%
Last 30 Days
""", unsafe_allow_html=True)
with col4:
st.markdown("""
โก Total Trades
1,247
This Month
""", unsafe_allow_html=True)
st.divider()
# Performance Chart
col1, col2 = st.columns([2, 1])
with col1:
st.markdown("### ๐ Portfolio Performance (30 Days)")
# Generate and display sample performance chart
df = generate_sample_data()
fig = go.Figure()
fig.add_trace(go.Scatter(
x=df['date'],
y=df['portfolio_value'],
mode='lines+markers',
line=dict(color='#4CAF50', width=3),
fill='tonexty',
fillcolor='rgba(76, 175, 80, 0.1)',
name='Portfolio Value'
))
fig.update_layout(
template='plotly_dark',
height=400,
showlegend=False,
margin=dict(l=0, r=0, t=0, b=0),
xaxis=dict(showgrid=False),
yaxis=dict(showgrid=True, gridcolor='rgba(255,255,255,0.1)')
)
st.plotly_chart(fig, use_container_width=True)
with col2:
st.markdown("### ๐ฏ Strategy Status")
strategies = [
{"name": "Market Making", "status": "active", "pnl": "+$342"},
{"name": "Arbitrage", "status": "active", "pnl": "+$156"},
{"name": "Grid Trading", "status": "active", "pnl": "+$89"},
{"name": "DCA Bot", "status": "inactive", "pnl": "+$234"},
]
for strategy in strategies:
status_class = "status-active" if strategy["status"] == "active" else "status-inactive"
status_icon = "๐ข" if strategy["status"] == "active" else "๐ด"
st.markdown(f"""
{strategy['name']}
{status_icon} {strategy['status'].title()}
{strategy['pnl']}
""", unsafe_allow_html=True)
st.divider()
# Feature Showcase
st.markdown("## ๐ Platform Features")
col1, col2, col3 = st.columns(3)
with col1:
st.markdown("""
๐ฏ
Strategy Development
- โจ Visual Strategy Builder
- ๐ง Advanced Configuration
- ๐ Custom Parameters
- ๐งช Testing Environment
""", unsafe_allow_html=True)
with col2:
st.markdown("""
๐
Analytics & Insights
- ๐ Real-time Performance
- ๐ Advanced Backtesting
- ๐ Detailed Reports
- ๐จ Interactive Charts
""", unsafe_allow_html=True)
with col3:
st.markdown("""
- ๐ค Automated Execution
- ๐ก Real-time Monitoring
- ๐ก๏ธ Risk Management
- ๐ Smart Alerts
""", unsafe_allow_html=True)
st.divider()
# Quick Actions
st.markdown("## โก Quick Actions")
col1, col2, col3, col4 = st.columns(4)
with col1:
if st.button("๐ Deploy Strategy", use_container_width=True, type="primary"):
st.switch_page("frontend/pages/orchestration/deploy_v2_with_controllers/app.py")
with col2:
if st.button("๐ View Performance", use_container_width=True):
st.switch_page("frontend/pages/performance/app.py")
with col3:
if st.button("๐ Backtesting", use_container_width=True):
st.switch_page("frontend/pages/backtesting/app.py")
with col4:
if st.button("๐๏ธ Archived Bots", use_container_width=True):
st.switch_page("frontend/pages/orchestration/archived_bots/app.py")
st.divider()
# Community & Resources
col1, col2 = st.columns([2, 1])
with col1:
st.markdown("### ๐ฌ Learn & Explore")
st.video("https://youtu.be/7eHiMPRBQLQ?si=PAvCq0D5QDZz1h1D")
with col2:
st.markdown("### ๐ฌ Join Our Community")
st.markdown("""
""", unsafe_allow_html=True)
# Footer stats
st.markdown("---")
col1, col2, col3, col4 = st.columns(4)
with col1:
st.metric("๐ Global Users", "10,000+")
with col2:
st.metric("๐ฑ Exchanges", "20+")
with col3:
st.metric("๐ Daily Volume", "$2.5M+")
with col4:
st.metric("โญ GitHub Stars", "7,800+")