BAZ.Luna
BAZ.Luna
The browser-based frontend for the BAZ trading platform. Real-time candlestick charts, a CodeMirror-powered glither.hft rule notebook, live signal markers, and a scrollable backlog — all communicating with BAZ.Palantir over WebSocket and REST.
BAZ.Luna is what the trader sees. It connects to BAZ.Palantir on :8080, receives
enriched candle and indicator events over WebSocket, and renders them as an interactive
candlestick chart with RSI sub-pane, Bollinger overlays, and signal markers. The
notebook editor lets you write, compile, and deploy glither.hft strategies without
leaving the browser.
Live indicator view
The panels below represent the kind of indicator data BAZ.Luna displays — sourced from BAZ.Palantir's enriched WebSocket stream:
Architecture
Browser (:5173 dev / dist/ prod)
│
├── src/app.js charts, WS, signals, backlog
├── src/notebook.js CodeMirror 6 + marked + hljs + compile
├── src/examples.js 3 notebooks (lazy)
├── src/glith-lang.js hljs language def (lazy)
└── src/styles.css RAGBAZ-themed
│
│ Vite dev proxy
├── /api ──REST──▶ BAZ.Palantir :8080
└── /ws ──WS──▶ BAZ.Palantir :8080 ──WS──▶ BAZ.CX :8000
All heavy libraries (CodeMirror 6, marked, highlight.js) are deferred via
requestIdleCallback — the chart and UI render before any editor code loads.
Initial entry: ~2.7 kB app + 8 kB CSS.
Notebook editor
Notebook editor
1Side-by-side layout: CodeMirror 6 editor on the left, rendered Markdown preview on the right. Three example notebooks are available from the toolbar:
Every fenced ```glith block gets a Compile button. Clicking it POSTs the
block to POST /api/rules/{name}/compile on BAZ.Palantir and shows the compilation
summary inline — symbols, windows, indicators derived, any check errors. A Compile
All button processes all blocks sequentially.
A cheat sheet panel (Ctrl+H) documents all glither.hft constructs: state syntax,
math macros (rsi, μ, σ, bbands_*), transact lifecycle, and then_log backlog.
Candlestick charts and indicators
Charts and indicators
2Lazy loading
BAZ.Luna keeps the initial paint lean. All heavy resources are deferred:
| Resource | Size | Load strategy |
|---|---|---|
| Initial entry | 79 B + 2.7 kB app + 8 kB CSS | Synchronous (instant) |
| CodeMirror 6 | 969 kB | requestIdleCallback |
| marked | 43 kB | On first viewer render |
| highlight.js | varied | On first code block render |
| Examples | 6.2 kB | On toolbar click |
| Glith language def | 1.1 kB | With highlight.js |
API contract
BAZ.Palantir API
3| GET /api/health | — | Health check |
| GET /api/candles | ?symbol=&timeframe= | Historical candle snapshot |
| GET /api/backlog | — | SQLite event log entries |
| GET /api/daemon/status | — | Strategy daemon state |
| POST /api/rules/:name/compile | rule source body | Compile glith source, return summary |
| WS /ws | — | Real-time ticks, candles, signals, annotations |
Tauri mode
BAZ.Luna can be packaged as a native application via Tauri v2 for Windows and Android. Tauri mode adds:
Build
npm install
npm run dev # Dev server with HMR at :5173
npm run build # Production build → dist/
Production build: ~1.8 MB across 16 chunks (gzip ~570 kB), builds in ~3s.
See BAZ.Palantir for the orchestration layer that powers the data stream, and the BAZ architecture experiment page for the full platform overview.