DAY 5 — DASHBOARD UI (CHATGPT-STYLE RESEARCH INTERFACE)

Skip to main content
< All Topics
Print

🎯 Goal

By the end of Day 5 you will have:

  • a working Streamlit dashboard
  • chat interface connected to your Phase 4 engine
  • ability to query your trading system visually
  • structured outputs displayed cleanly
  • basic controls (models, regimes, datasets)

This is where your system becomes usable daily.


🧱 STEP 1 — CONNECT UI TO YOUR ENGINE

Make sure you are in your project:

cd AI_TRADING_SYSTEM
source venv/bin/activate

📦 STEP 2 — CREATE DASHBOARD FILE

touch dashboard.py

🖥️ STEP 3 — BUILD STREAMLIT UI

Paste into dashboard.py:

import streamlit as st
from analysis_engine import run_analysis

st.set_page_config(page_title="AI Trading Research System", layout="wide")

st.title("📊 MAC AI TRADING RESEARCH SYSTEM")

# ----------------------------
# SIDEBAR CONTROLS
# ----------------------------
st.sidebar.header("Controls")

model = st.sidebar.selectbox(
    "Select Model",
    ["llama3.1:8b", "qwen2.5:14b", "deepseek-r1:20b"]
)

st.sidebar.write("System uses Phase 4 RAG + LLM engine")

# ----------------------------
# MAIN INPUT
# ----------------------------
question = st.text_area("Ask a trading strategy question:")

run_btn = st.button("Run Analysis")

# ----------------------------
# OUTPUT
# ----------------------------
if run_btn and question:

    with st.spinner("Analyzing trading data..."):

        result = run_analysis(question, model=model)

    st.subheader("📈 Analysis Result")
    st.write(result)

▶️ STEP 4 — RUN DASHBOARD

streamlit run dashboard.py

🧠 STEP 5 — WHAT YOU SHOULD SEE

A web interface with:

Left Sidebar:

  • model selector (7B / 14B / 20B)

Center:

  • text input box
  • “Run Analysis” button

Output:

  • structured trading analysis from Phase 4 engine

🧠 STEP 6 — VERIFY FULL PIPELINE

When you run a query:

Why does momentum fail in high volatility regimes?

System flow:

  1. UI sends query
  2. Phase 4 retrieves RAG context
  3. LLM (14B/20B) analyzes
  4. structured output returned
  5. Streamlit displays result

⚙️ STEP 7 — OPTIONAL IMPROVEMENTS (STILL DAY 5)

Add model display

st.sidebar.write("Current model:", model)

Add save button placeholder

if st.button("Save Analysis"):
    st.success("Saved (Phase 6 will implement storage fully)")

Add formatting separator

st.markdown("---")

🧠 WHAT YOU NOW HAVE

You now have:

✔ full chat-style UI

✔ working backend engine connection

✔ RAG-powered analysis access

✔ model switching capability

✔ structured output display


🚫 WHAT THIS IS NOT

  • ❌ not a trading bot
  • ❌ not real-time system
  • ❌ not autonomous AI agent
  • ❌ not prediction engine

It is:

a structured research dashboard over your historical trading system


💡 ONE-LINE SUMMARY

Day 5 turns your AI trading engine into a usable ChatGPT-style dashboard for querying and analyzing your historical strategies.