Web dashboard¶
The engine serves a browser dashboard from web/static/. It shows brokers, strategies and P&L in a main
window and opens each tool (ladder, ticket, orders, fills, positions, P&L, log) in a popup window of its
own. It is plain ES modules with no build step, talking to the engine over the REST API and
WebSocket. Everything it does you can also do with curl.
Open http://localhost:<web_server_port>. The port is 3000 in the example config and 8080 when the
key is missing.
Setup¶
The dashboard is part of the web_service block of the engine config. The server is on unless
"enabled": false.
| Key | Type | Default | Notes |
|---|---|---|---|
enabled |
bool | true |
Turns the web service off. The Simulator link goes with it |
web_server_port |
integer | 8080 |
The example config uses 3000 |
web_server_static_path |
string | web/static |
Relative to the working directory, so run the engine from the install directory |
web_server_cors |
bool | true |
The three Access-Control-* headers, see REST API |
web_server_ladder_release_ms |
integer | 5000 |
Grace before an instrument no ladder shows is released at its broker |
web_server_workspaces_file |
string | state/workspaces.json |
Saved window layouts, written on every change |
web_server_allow_popups |
object | off | {"ip", "port"}, Windows only, see below |
web_server_secure_origin |
object | off | The same shape, Windows only |
ladder_config |
object | {"default_qty":0.01,"per_instrument":{}} |
Default order sizes. See below |
config_queue_size, config_control_size |
integer | 65536, 4096 |
The event bus producer that carries parameter updates and ladder holds |
ladder_config holds default_qty and, per instrument, default_qty and default_broker_id:
"ladder_config": {
"default_qty": 0.01,
"per_instrument": { "BTC-USD": { "default_qty": 0.001, "default_broker_id": 1 } }
}
An order's quantity starts at the instrument's default_qty, else the smallest order its broker takes,
else the top-level default_qty. default_broker_id picks the broker the Ticket offers first. The
dashboard rewrites this object whenever you type a new quantity on a ladder, but only in memory.
Keep what you want to survive a restart in the config file.
MANUAL needs the strategies block
Every order from the dashboard is booked to the built-in MANUAL strategy, and the engine registers
it while loading strategies. With strategies.enabled false there is no MANUAL: the ladders list
nothing and orders answer 404. See Strategy reference.
A release package ships the dashboard under web/static/, next to config/config_example.json. The server
reads each file from disk per request and tells the browser not to cache it, so a page reloaded after an
engine update runs the new scripts.
Windows-only parts¶
Four things only work on Windows, and only for the browsers Edge and Chrome.
Popups policy. A browser lets one click open one popup, unless the site may open popups, and a
workspace opens several windows at once. web_server_allow_popups has the engine add the dashboard's
origin to the browser's PopupsAllowedForUrls policy:
ip defaults to localhost and port to the server's. Use the address you type in the browser. The
engine writes http://<ip>:<port> under HKCU\Software\Policies\Microsoft\Edge\PopupsAllowedForUrls and
the same key under Google\Chrome, as the next free numbered value, and logs whether it added or found
it. The browser applies it on restart, or on Reload policies at edge://policy. The engine never
removes an entry, so delete it by hand if you stop wanting it. An invalid value is a warning and nothing
is written. On another OS the same setting only logs that policies live in the Windows registry.
Without it, each click opens one window and a start with no click opens none, so a workspace opens its first window and a dialog lets you open the rest, one per click. Allowing popups for the host in the browser's settings does the same by hand.
Secure origin policy. Placing a window on another screen takes the Window Management API, which a
browser gives only to a secure origin: https, or http on localhost. Over http://<ip> a workspace's
windows all open on the main window's screen. web_server_secure_origin takes the same
{"ip", "port"} and lists the origin in OverrideSecurityRestrictionsOnInsecureOrigin, which is what
the "Insecure origins treated as secure" flag sets. The flags page does not show policies, so the flag
stays Disabled there. edge://policy lists it, and isSecureContext in the DevTools console reads
true.
Treating http as secure
The policy hands the browser's window APIs to plain http, which anyone on the network path can rewrite. Set it only for an address on a network you trust.
The helper script. When the browser runs on another Windows PC than the engine, run
scripts/slick-trader-web.bat
there, as the user who trades. It is a batch file that hands the rest of itself to PowerShell.
slick-trader-web.bat asks for the address and port
slick-trader-web.bat 192.168.1.20 3000 chrome port 3000 and Edge unless given
slick-trader-web.bat remove 192.168.1.20 3000 undoes it
It lists http://<host>:<port> in both policies of both browsers, then adds Desktop and Start menu
shortcuts that open the dashboard as an app (no tabs or address bar), through a small helper exe it
builds into %LOCALAPPDATA%\SlickTrader. Restart the browser, or reload policies, afterwards. remove
takes the entries and shortcuts out again, and the helper with the last one. On the engine's own PC the
two config keys do the policy part, and you can run the script with localhost for the shortcut.
The app helper. slick-trader-app.exe opens each dashboard at /app/<token>/ (the server redirects
that path to /?grouped) and watches the foreground window from outside the browser. When any window of
that dashboard comes to the front, by title bar, taskbar or Alt+Tab, the others go right under it, without
taking focus. Each launch is a dashboard of its own. Opened any other way, the page does the same on the
first click or key in a window, because a page may raise windows only then. That relies on how Chrome
and Edge treat windows opened by name, and was checked in Edge.
Browser chrome you cannot remove
Chrome and Edge show a thin read-only address strip on a popup, and no page can remove it. Starting
the main window as an app (msedge --app=http://<host>:3000, or chrome --app=...) drops its own
address bar and tabs. Skip --kiosk, which locks the main window to full screen.
The main window¶
A toolbar on top, then four panels.
- Toolbar. The name and the engine's version (read from
/api/health), a button for each tool, the Workspaces menu and a connection indicator. The Log button carries a red count of errors logged while the Log window was closed. - Venues. Each broker's market data and order connection, live: a dot, and
(off)or(disconnected)after the name. It reads/api/brokersandbroker_statusmessages. - Simulator. Only in the
Simenvironment, see Simulator. - P&L totals. Total, realized and unrealized, summed over strategies. Refreshed every 5 s and on
each
pnl_update. - Strategies. Each strategy's status (a halted or paused one shows the first part of its reason, with
the full text as the tooltip), realized, unrealized and total P&L, and three buttons. The play
button starts it, the stop button stops it, and the gear opens its parameters as JSON, which Save sends to
PUT /api/strategies/:id/config. The saved parameters are applied on the strategy's own thread and written back to its.config.json. MANUAL always runs and has no buttons. A halt or pause shows within 5 s, since status is polled and not pushed.
Off production, an amber bar across the top of every window names the environment, and the window's
title starts with it ([Sim] Ladder). The environment is the config's top-level environment, or
Live Sim or Historical Sim once slick-sim's feeds are known. Anything but Production or Prod
in any case is not production, so a misspelling shows the bar rather than hiding it.
Each tool window remembers its size and position, per window name, in the browser's localStorage.
Windows and dashboards¶
The toolbar buttons open tools as popups, with no tabs, menus or bookmark bar. A ladder button opens a new ladder each click (up to 64). The other buttons focus their window if it is open. Closing the main window closes the tool windows it opened, and reloading it keeps them.
Each main window is a dashboard of its own. Two open on one host, in tabs or windows, keep their tool windows and their logs apart, and a workspace saves and replaces only its own dashboard's windows. The saved workspaces live in the engine, so every dashboard shares them. If a main window dies without closing, as in a crash, its tool windows belong to no dashboard any more and have to be closed by hand.
Workspaces¶
A workspace is a named set of tool windows with each one's position, size and what it shows: a ladder's instrument and settings, for instance. The Workspaces menu in the toolbar works on them.
- Open. Pick one. The open tool windows close and the workspace's own open where they were. The workspace is re-read from the engine first, since another browser may have saved it.
- Save to. Writes the open windows to the current workspace.
- Save as. A new name, or an existing one once you confirm.
- Delete. Any workspace but
Default, after a confirm. Its windows stay open, now under Default. - At start. If no tool window answers when the main window starts, it opens the last used workspace. Reloading the main window alone changes nothing.
Default always exists and cannot be deleted. Names are trimmed, so "Morning " is Morning. The main
window is not part of a workspace, because a page cannot move a window the user opened. A workspace's
tool that the dashboard no longer has is skipped, and the log says which.
Each window opens inside one screen, moved and shrunk to fit, and one saved on a screen that has since gone (after undocking, say) opens on the main window's. Chrome and Edge keep popups on the main window's screen unless the site may manage windows. Opening a workspace with a window on another screen asks for that permission. A start does not ask, because the browser refuses a request with no click behind it. That needs a secure origin, see Windows-only parts.
The file format and limits are under REST API.
Tool windows¶
Ladder¶
A price ladder for one instrument, drawn on a canvas by the vendored slick-ladder library. Click a level to trade it.
The instrument box is a searchable dropdown: type to filter (any case), arrow keys and Enter to pick, Escape to close. It shows the first 200 matches and says how many more there are. A new ladder opens with nothing picked. A reloaded one, or one a workspace opened, comes back on its instrument. What it lists is described in Instruments and streams.
Columns. Work, Bid, Price, Ask and LTQ, under a header row. The tick is the one the broker defined.
Without one the ladder falls back to a small table (ES and NQ 0.25) and then 0.01.
- Work shows MANUAL's resting orders on that row, as the quantity left and the number of orders,
0.65 (2), green for buys and red for sells. It follows acks, modifies, fills and cancels, and comes back after a reload because the window reads/api/orderson connect. Other strategies' orders do not show. An order stays until its broker says it is cancelled. - LTQ shows the last trade's quantity at its price: green when a buyer lifted the offer, red when a seller hit the bid, white when the venue did not say.
Trading. A left click in the Bid column buys at that row's price, a left click in the Ask column sells at it, both as limit orders. The Price and LTQ columns do nothing. The quantity starts at the instrument's default, described under Setup, and a quantity you type becomes that instrument's default. Until the ladder config loads the quantity box is disabled and clicks send nothing, and a click on an instrument with no known broker is refused with a message.
With Confirm orders on (the default) a click opens a dialog first:
- It shows the side, quantity, instrument and price, and
LimitorMarketwith the time in force. - The Buy or Sell button, or Enter, sends it. Cancel, Escape or a click outside drops it.
- It ignores a confirm in its first half second, so a double click cannot place the order.
- Neither button has the focus when it opens, because Space would press it and Space centers the ladder.
The arrow button next to the gear shows the Qty, Price and TIF boxes, hidden at first. The ladder remembers the choice for every ladder of that browser. A price you type overrides the level for one order. The TIF is a pick of GTC, IOC, FOK or DAY. It starts at DAY on a CME or ICE instrument and at GTC elsewhere, and stays as you picked it from one order to the next. Switching to a crypto instrument turns DAY into GTC, since those brokers reject it. A market order (a click with no price) left on GTC or DAY goes out IOC. Hiding the boxes clears the price and puts the TIF back to the default.
A work-column click cancels without a confirm:
- Left click on a Work cell cancels every one of MANUAL's orders on that row, both sides, at once.
- Right click opens a list of them, each with its own Cancel, plus Cancel all. The list updates on fills and cancels and closes when the last order is gone.
- A middle click, or a click on a row with no orders, is left to the ladder.
On Windows the browser's own menu would follow a right click, and it lands on the list. The ladder swallows that one menu.
Settings (the gear button). Each ladder's own:
| Setting | Default | Notes |
|---|---|---|
| Confirm orders | on | Off sends a click's order at once |
| Auto center | off | Keeps the bid/ask midpoint on the middle row and stops the wheel from scrolling. Off, the wheel scrolls |
| Show columns | Work and LTQ on | Hides either column |
| Empty price rows | Show | Only on a CME or ICE ladder, see below |
| Row height | 20 px | 16, 18, 20, 24 or 28 |
They last through a reload (kept in the window's sessionStorage) and a workspace saves them with the
ladder, but only the ones that differ from the defaults. A new ladder starts on the defaults.
Empty rows. A CME or ICE book is a fixed grid of price levels. The ladder keeps a row for every price, so rows stay put as levels come and go, and a click on an empty row trades at its price. Hide turns that off. Other venues never show empty rows.
Mouse and keys.
| Input | Effect |
|---|---|
| Left click, Bid or Ask column | Order at the row's price (buy on Bid, sell on Ask) |
| Left click, Work cell | Cancel the row's MANUAL orders |
| Right click, Work cell | List them |
| Middle click | Center the ladder. It never trades |
| Wheel | Scroll 5 rows. Off while Auto center is on |
| Space | Center the ladder |
Several ladders can run side by side, each streaming its own book.
Ticket¶
One order for any listed instrument, booked to MANUAL: instrument, broker, side, Market or Limit, time in force, quantity and (for a limit) price.
- The broker defaults to the one that lists the instrument, if its order entry is on, else the first
with order entry on.
default_broker_idinladder_configoverrides it. A broker with order entry off cannot be picked, and the list labels one(no order entry)or, when it is on but down,(disconnected). - A limit order offers DAY, GTC, IOC, FOK and GTD. A market order offers IOC and FOK. The default is DAY on CME and ICE and GTC elsewhere, as on the ladder.
- The quantity starts at the instrument's default and follows it until you type one.
- A ticket takes prefill parameters from its URL (
instrument,side,price,qty), or over the channel when it is already open.
Orders¶
Open orders across strategies, with Modify, Cancel and a Cancel all that asks first. A cancelled order stays listed until its broker says it is gone. A burst of order updates reloads the list once, 100 ms after the first. The Modify dialog starts with the order's price and its remaining quantity, and sends both as new values.
Fills¶
The last 1,000 fills, newest first: the engine's history when the window opens, then each fill as it
comes. Leg fills of spread orders are marked (leg). Fills are matched by seq, so none shows twice.
The columns are time, strategy, instrument, side, quantity, price, fee, remaining, order and fill ids.
Positions¶
Positions by strategy, reloaded on connect, every 5 s, and 250 ms after a fill: quantity, average price and realized P&L.
P&L¶
A line chart of total, realized and unrealized P&L summed over strategies, drawn by Chart.js. It starts
when the window opens, keeps 300 points, adds one per pnl_update and one on connect, and the engine
keeps no history for it.
Log¶
The main window's system log, the last 500 entries: connection changes, order updates, and what you do in any window. Entries are coloured by level, and Clear empties it. The main window keeps the log and sends it to the Log window when that opens, so with the main window closed there is nothing to show.
Instruments and streams¶
A ladder lists the instruments brokers define, narrowed by MANUAL's instruments parameter, plus the
instruments the other strategies subscribe. MANUAL gets its parameters from a <name>.config.json
whose name is MANUAL in strategies.strategy_configs_folder:
Entries are symbols, or prefixes ending in *. With no instruments parameter the ladder lists every
instrument defined, and with [] none. An update through PUT /api/strategies/MANUAL/config replaces the
whole parameter set, so one without instruments lists everything again.
Coinbase and Hyperliquid define their products when they start. Coinbase reads them from the Coinbase
broker's market_data.rest_url (default https://api.coinbase.com).
Nothing streams until a ladder picks an instrument. MANUAL then subscribes the instrument's level 2 book and
its trades (for LTQ) at its broker, and lets them go web_server_ladder_release_ms after the last ladder on
it closes or switches away. That never drops a feed a strategy also subscribed. If a strategy already
streams the book (LEVEL2 or ORDER_BOOK) or the trades, the ladder uses that stream. A strategy's quotes
carry neither, so they do not count. The mechanism is in WebSocket.
A window gets the list by sending {"type":"subscribe","channel":"instruments"}. It can be megabytes
with MANUAL on every instrument, so only windows that have a ladder or a Ticket ask.
Frontend architecture¶
There is no build step. The browser loads ES modules straight from web/static/, and an import map in
index.html and tool.html points the three bare names at the vendored files:
<script type="importmap">
{ "imports": { "preact": "./lib/preact.js", "preact/hooks": "./lib/hooks.js", "htm": "./lib/htm.js" } }
</script>
Components are Preact functions written as tagged templates with
htm, so there is no JSX and nothing to compile. Every window opens
its own WebSocket and is its own page: index.html loads js/main.js, and tool.html?t=<tool> loads
js/tool.js, which mounts the tool named in the URL from a fixed list (the name never becomes an import
path), under the environment bar.
Core modules¶
| Module | Job |
|---|---|
core/html.js |
Preact with htm, and the hooks every view imports |
core/api.js |
The REST client, and the number and time formatters |
core/websocket.js |
A reconnecting WebSocket client that emits each message by its type |
core/connection.js |
The window's one socket, useWs, useOnConnect, useConnection, channel re-subscribing |
core/health.js, core/sim.js |
/api/health and the Sim state, each asked once per connect and shared by all views |
core/hooks.js |
useInterval, useCoalesced, shared() (one value for every view of a window), title helpers |
core/store.js |
localStorage and sessionStorage as JSON, with fallbacks for when storage is refused |
core/bus.js |
The BroadcastChannel between a dashboard's windows |
core/windows.js |
The tool registry, opening, placing and closing popups, workspaces' layout calls, raising windows |
core/instruments.js |
The instrument list, tick and quantity defaults, the ladder config |
core/log.js, core/notify.js, core/load.js |
The log ring, toasts and dialog, and a one-time classic script loader |
The bus¶
A main window and the tool windows it opened talk over a BroadcastChannel named slick-trader. Every
message is {kind, dashboard, ...data} and a window ignores any whose dashboard is not its own. A main
window makes its id at start, and a tool window reads it from window.opener, so two dashboards on one host
never mix. The kinds in use:
log,log-entry,log-sync,log-history,log-closedandlog-clearmove the log between the main window and the Log window.layout-queryandlayout-reportlet the main window ask where each tool window is, for a workspace save.workspace-closecloses them.main-ready,main-closing,window-awayandtool-paramscover startup, close-together, raising and a Ticket's prefill.
Storage¶
| Where | Key | What |
|---|---|---|
localStorage |
st.win.<window name> |
A tool window's last position and size |
localStorage |
ladder.controls |
Whether the Qty, Price and TIF boxes show |
sessionStorage |
ladder.instrument |
The ladder's instrument, kept across a reload |
sessionStorage |
ladder.settings |
The ladder's settings |
File map¶
web/static/
index.html, tool.html the main window, and the shell of every tool window
css/main.css the one stylesheet
lib/ vendored: preact.js, hooks.js, htm.js, chart.umd.js
js/main.js toolbar, summary panels, the log ring
js/tool.js mounts one tool, chosen from a fixed list
js/slick-ladder.js the ladder canvas (vendored, with its .map)
js/core/ api, websocket, connection, health, sim, windows, bus, instruments,
log, notify, load, store, hooks, html
js/components/ picker, strategies, workspaces, env-bar, sim-panel, icons
js/tools/ ladder, order (the Ticket), orders, fills, positions, pnl, log
Updating the vendored libraries¶
package.json at the repo root names the versions (preact 11.0.2, htm 3.1.1, chart.js 4.4.1 and
@slickquant/slick-ladder ^0.6.0), and node_modules/ is not committed. Run npm install, then copy
each dist file to its name under web/static/:
From node_modules/ |
To web/static/ |
|---|---|
preact/dist/preact.mjs |
lib/preact.js |
preact/hooks/dist/hooks.mjs |
lib/hooks.js |
htm/dist/htm.module.js |
lib/htm.js |
chart.js/dist/chart.umd.js |
lib/chart.umd.js |
@slickquant/slick-ladder/dist/slick-ladder.js |
js/slick-ladder.js (and its .map) |
The copies in the tree are those files with the trailing //# sourceMappingURL= line dropped, except
htm and the ladder, which are byte for byte. Keep the .js name: the server sends only .js files as JavaScript, and a
browser refuses a module served as anything else. Chart.js and slick-ladder are classic scripts, loaded
on demand by the window that needs them (lib/chart.umd.js by P&L, js/slick-ladder.js by the ladder)
and used as the globals Chart and SlickLadder.
WebAssembly¶
The ladder runs the library's JavaScript PriceLadder today. The npm package also ships a
WasmPriceLadder (an ES module at @slickquant/slick-ladder/wasm-adapter, with the book in a Web Worker)
and a dist/wasm/ folder of .NET runtime files. The dashboard uses neither: it loads the plain
slick-ladder.js bundle as a classic script, and no wasm files are in web/static/. Turning it on would
mean importing the adapter as a module, copying that folder in, and giving the static handler a
.wasm content type, which its extension table does not have. Nothing here measures whether the
ladder needs it.
Related¶
- REST API and WebSocket for every message the dashboard sends or reads.
- Simulator for the panel and environment names in a
Simsetup. - Configuration for the rest of the config file.