Skip to main content

BAZ.Luna

BAZ.LUNA
// trading frontend · Vite + lightweight-charts

BAZ.Luna

products/baz-luna · notebook editor · real-time charts · signal visualization

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.

CHARTS · EDITOR · SIGNALS · WEBSOCKET · VITE · TAURI

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:

BAZ.HFT · INDICATOR SUITE
HOLD
BAZ/USD · 1H
141.04+0.11%BB20SMA20SMA50
T-60hNOW
Volume
307033RSI · 14neutral
Stochastic 14/3
%K
5.4
%D
1.8
MACD 12/26/9
MACD-0.598
Signal-0.343
Hist-0.255
MACD12 / 26 / 9
── signal── macd
Indicator Summary
IndicatorPeriodValueSignal
SMA20142.74below
SMA50142.73below
RSI1433.0neutral
Stoch %K145.4oversold
MACD Hist12/26/9-0.255bearish

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
✓LEAN INITIAL LOAD

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​

A

Notebook editor

1
CodeMirror 6 · glith syntax highlighting · inline compile

Side-by-side layout: CodeMirror 6 editor on the left, rendered Markdown preview on the right. Three example notebooks are available from the toolbar:

Mean ReversionRSI oversold + lower Bollinger band + volume confirmation → market_buy
Trend FollowingSMA(9) > SMA(21) golden cross + RSI confirmation → market_buy
Blank TemplateEmpty notebook with pragma, state, and rule scaffolding

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​

B

Charts and indicators

2
lightweight-charts · RSI sub-pane · signal markers
Main paneCandlestick chart (lightweight-charts) with optional Bollinger Band overlays and SMA/EMA line series.
RSI sub-paneRSI(14) oscillator line series below the main chart. Overbought/oversold bands drawn at 70/30.
Signal markersBuy (green ▲), Sell (red ▼), Close (yellow ●) markers on the candlestick chart from rule fires.
Backlog viewerScrollable SQLite backlog — each entry shows timestamp, rule name, action, and JSON payload.
AnnotationsFree-form text annotations via the WebSocket annotation side-channel (opt-in end-to-end).
RSI sub-pane · BTC/USDT · 1m
RSI(14)
34.0
Stoch %K
22.0
Confidence
76.0
Signal timeline · 28-barenriched oscillation · WS stream
T-28T-21T-14T-7

Lazy loading​

BAZ.Luna keeps the initial paint lean. All heavy resources are deferred:

ResourceSizeLoad strategy
Initial entry79 B + 2.7 kB app + 8 kB CSSSynchronous (instant)
CodeMirror 6969 kBrequestIdleCallback
marked43 kBOn first viewer render
highlight.jsvariedOn first code block render
Examples6.2 kBOn toolbar click
Glith language def1.1 kBWith highlight.js

API contract​

C

BAZ.Palantir API

3
all proxied through Vite dev server
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/compilerule source bodyCompile 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:

File system accessLoad and save `.glith` rule files directly from the local filesystem.
Embedded serverOptional embedded BAZ.Palantir process for a fully standalone installation.
Native packagingSingle-binary distribution — no separate server setup required.

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.