import streamlit as st import pandas as pd from datetime import datetime import random # ===================================================================== # 1. PAGE INITIALIZATION & HIGH-FIDELITY RETRO STYLING # ===================================================================== st.set_page_config( page_title="Trading Office - Realtime Bot Command Center", page_icon="☕", layout="wide", initial_sidebar_state="expanded" ) # บังคับโครงสร้างและโทนสีให้ตรงตามรูปภาพหน้าจอห้องทำงานร้านกาแฟพิกเซล st.markdown(""" """, unsafe_allow_html=True) # ===================================================================== # 2. SESSION STATE ENGINE (ระบบควบคุมหน่วยความจำพอร์ต) # ===================================================================== if "live_equity" not in st.session_state: st.session_state.live_equity = 20882.27 if "spread_val" not in st.session_state: st.session_state.spread_val = 3.502 st.session_state.live_equity += random.uniform(-4.5, 6.5) st.session_state.spread_val += random.uniform(-0.01, 0.01) # ===================================================================== # 3. DYNAMIC DATA INTEGRATION (ตัวแปรเก็บสถิติตลาด) # ===================================================================== agent_01_name = "Quant_3Zone_v2.7.2" agent_01_win_rate = 57.97 agent_01_target = 93.3 agent_01_status = "WAIT / In Range" agent_02_name = "CRO_Firewall_v3.1" agent_02_risk_load = 1.15 agent_02_status = "Secure" # ===================================================================== # 4. SIDEBAR IMPLEMENTATION (แถบควบคุมฝั่งซ้าย) # ===================================================================== with st.sidebar: st.markdown('', unsafe_allow_html=True) st.markdown('', unsafe_allow_html=True) st.markdown('', unsafe_allow_html=True) st.markdown("🟢 **Spread Grid**
XAUUSD / PURE-QUANT", unsafe_allow_html=True) st.markdown('', unsafe_allow_html=True) st.markdown(f""" """, unsafe_allow_html=True) st.markdown('', unsafe_allow_html=True) st.markdown("• 🛠️ **Trader:** `Order path only`
• 🗄️ **Recorder:** `Trade file connected`", unsafe_allow_html=True) st.markdown('', unsafe_allow_html=True) st.write("`XAUUSD.iux` | `BRENTOIL` | `WTI`") # ===================================================================== # 5. TOP NAVIGATION BAR (แถบเมนูส่วนบน) # ===================================================================== st.markdown("""
Dashboard
AI Agents
Trades
Analytics
Risk
● 2/2 Bots Running
""", unsafe_allow_html=True) # ===================================================================== # 6. MAIN CAFE CANVAS WORKSPACE (โซนห้องทำงานร้านกาแฟพิกเซล) # ===================================================================== st.markdown('
', unsafe_allow_html=True) st.markdown('
🌳
', unsafe_allow_html=True) st.markdown('
☕ 🏺 ☕ ☕
', unsafe_allow_html=True) st.markdown(f"""
RUNNING
Agent: {agent_01_name}
Mid Spread: {st.session_state.spread_val:.3f}
Win Rate / Target: {agent_01_win_rate}% / {agent_01_target}%
Trade: {agent_01_status}
👨‍💻
🗲 WORKSTATION_01
MONITOR
Agent: {agent_02_name}
Risk Lot Size: {agent_02_risk_load}% (Max 2%)
Account Equity: {agent_02_status}
Last Update: Realtime
👩‍💻
🛡️ RISK_FIREWALL_02
🐈
""", unsafe_allow_html=True) st.markdown('
', unsafe_allow_html=True) # ===================================================================== # 7. QUICK CONTROLLER MANUAL (แผงควบคุมระบบด้านล่างสุด) # ===================================================================== st.write("") control_col1, control_col2, control_col3 = st.columns([1, 1, 2]) with control_col1: if st.button("▶ START SYSTEM ALL BOTS"): st.toast("ส่งสัญญานวิทยุเปิดคอมพิวเตอร์ให้เอเจ้นท์เริ่มต้นรันไทม์!") with control_col2: if st.button("🛑 EMERGENCY SHUTDOWN"): st.toast("Risk Firewall สั่งตัดไฟพอร์ตและระเบิดสัญญาทั้งหมดชั่วคราวเพื่อเซฟวงเงินทุน!") with control_col3: st.caption("📟 *ระบบทำการเคลียร์ปีกกาหลอนและซ่อมรอยรั่วสไตล์ลิ่งหน้าจอเรียบร้อยแล้ว ปลอดภัยตามเกณฑ์มาตรฐาน Docker App*")