xiaohongshu
xiaohongshu
dashboard-symbol-discovery
Auto-discover dashboard symbols from loaded RL models. Trigger when: (1) dashboard shows old/wrong symbols, (2) symbols mismatch between live trader and dashboard, (3) adding new models to system, (4) dashboard shows NO_MODEL for all symbols.
Full skill instructions
| Item | Details |
|---|---|
| Date | 2024-12-24 |
| Goal | Fix dashboard showing stale symbols that don't match trained models |
| Environment | scripts/monitor_dashboard.py, scripts/live_trader.py |
| Status | Success |
The dashboard was showing hardcoded symbols (SPY, QQQ, AAPL, MSFT, NVDA, GOOGL, TSLA, BTCUSD, ETHUSD) even when:
Root cause: DashboardConfig.symbols had hardcoded defaults, and the live trader didn't pass --symbols to the dashboard subprocess.
# WRONG: Hardcoded defaults in DashboardConfig
@dataclass
class DashboardConfig:
symbols: List[str] = field(default_factory=lambda: [
"SPY", "QQQ", "AAPL", "MSFT", "NVDA", "GOOGL", "TSLA", "BTCUSD", "ETHUSD"
])
# CORRECT: Empty default, auto-discover from models
@dataclass
class DashboardConfig:
# Symbols to monitor - auto-discovered from models if not specified
symbols: List[str] = field(default_factory=list)
# In run_dashboard(), after loading predictors:
if not cfg.symbols:
if predictors:
cfg.symbols = list(predictors.keys())
logger.info(f"Auto-discovered {len(cfg.symbols)} symbols from models: {cfg.symbols}")
else:
# Fallback if no models found
cfg.symbols = ["SPY", "QQQ"]
logger.warning("No models found - using fallback: SPY, QQQ")
# In live_trader.py, when launching dashboard subprocess:
dashboard_cmd = [
sys.executable, "-m", "scripts.monitor_dashboard",
"--paper", str(args.paper),
"--interval", str(args.dashboard_interval),
"--keys-file", args.keys_file,
"--symbols", ",".join(symbols), # Pass active symbols
"--show"
]
logger.info(f"Dashboard symbols: {symbols}")
--symbols argument (highest priority) - Explicitly passed symbols| Attempt | Why it Failed | Lesson Learned |
|---|---|---|
| Hardcoded symbol defaults | Symbols became stale when models changed | Use empty default + auto-discovery |
| Dashboard subprocess without --symbols | Live trader and dashboard had different symbol lists | Always pass symbols to subprocess |
| Only auto-discovery | Would ignore explicit user preferences | Support CLI override as highest priority |
| No fallback | Crashes when no models exist | Always have a minimal fallback |
The live trader and dashboard have independent symbol selection:
live_trader.py:
1. Discovers models from disk (*.pt files)
2. Runs universe selection (constrained to symbols WITH models)
3. Launches dashboard subprocess
monitor_dashboard.py (OLD - BROKEN):
1. Uses hardcoded defaults
2. Ignores loaded predictors for symbol list
3. Shows NO_MODEL for symbols without models
monitor_dashboard.py (NEW - FIXED):
1. If --symbols passed, use those
2. Else auto-discover from loaded predictors
3. Else use minimal fallback
Both live_trader and dashboard discover models the same way:
model_dir = Path("models/rl_symbols")
model_files = list(model_dir.glob("*.pt"))
for model_file in model_files:
# Parse SYMBOL_TIMEFRAME.pt
stem = model_file.stem # e.g., "AAPL_1Hour"
parts = stem.rsplit("_", 1)
symbol, timeframe = parts[0], parts[1]
Already existed but wasn't being used:
parser.add_argument('--symbols', type=str, default=None,
help='Comma-separated symbols to monitor')
# Parsing:
if args.symbols:
cfg.symbols = [s.strip() for s in args.symbols.split(',') if s.strip()]
scripts/monitor_dashboard.py:
- Line 297-299: Changed default symbols to empty list
- Line 961-969: Added auto-discovery logic
scripts/live_trader.py:
- Line 2033: Added --symbols argument to dashboard command
- Line 2037: Added logging for dashboard symbols
scripts/monitor_dashboard.py: Lines 297-299 (config), 961-969 (auto-discovery)scripts/live_trader.py: Lines 2028-2037 (subprocess launch)models/rl_symbols/*.pt: Model files for discoveryxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience