Ioannis (John) Konstas Konstas.Engineering Notes
Networking · Cybersecurity · Infrastructure
Trading Systems

Konstas Markets Desk: An FX Dealing Room on One Mac

Articles · October 2026 · Ioannis (John) Konstas

A complete foreign-exchange dealing room that runs on one Mac mini: live two-way prices from eight banks, Reuters-style dealing conversations, client calls, orders, forwards and money markets, a full back office with double-entry accounting, and every formula of the ACI Dealing Certificate.

Interbank FX is learnt on the desk, not in a textbook. The Markets Desk recreates that desk: a market that never stops moving, counterparties who answer in dealer shorthand and refuse stale prices, clients who call with fifteen seconds to quote, and a back office that confirms, settles and books every deal. It was built as a study companion for the ACI Dealing Certificate (exam 002-101) and grew into a full trading simulator with a web dealing room and an old-school terminal.

Everything runs locally. The server listens only on the Mac's loopback address, so nothing on the network or the internet can reach it. The only things it fetches are public reference prices.

Capabilities

The screens

Web dealing room: rate tiles on the left, EUR/USD candlestick chart, eight-bank depth table, order ticket, conversations and news wire on the right, positions table at the bottom
Web dealing room (localhost:9300/dealing). Prices are shown the Reuters way, big figure small and pips large. Click the bid to sell or the offer to buy. The chart marks your average price and working orders; the depth table shows every bank's price and size.
Terminal dealing screen: amber header, rates board with bid, ask, spread, change, high, low, position and open P&L, incoming calls bar, news and street tape, and HELP MINE output
Terminal dealing screen (the desk command). The top of the screen redraws four times a second; commands are typed at the DEAL> prompt. Shown here: the depth for EUR/USD and the built-in help for MINE.
Terminal candlestick chart of EUR/USD in one-minute candles with a price scale and time axis
Terminal chart (CHART EUR). One-minute candles in simulated time, drawn with block characters; 5, 15 and 60-minute views are available.
Forward curve table for EUR/USD with tenor, start and end dates, days, bid and offer points, outright prices and deal buttons
Forwards. The EUR/USD forward curve from overnight to one year: value dates under modified-following, swap points from the interest differential, outright prices, and buttons for outrights and swaps.
Back office tab listing trade tickets with trade date, value date, deal, counterparty and status, including one unmatched confirmation with a MATCH button
Back office. Every deal becomes a ticket. Here one confirmation disagrees on the value date and waits to be resolved with MATCH.
Ledger tab showing the trial balance marked balanced and account balances
Ledger. The trial balance of the general ledger, which must read balanced in every currency, followed by the latest journals.
Performance tab with deal count, win rate, realised P&L, best and worst trades and results by pair
Performance. Win rate, average win and loss, best and worst trades, results by pair and by deal type, drawdown, and the hit rate on client calls.
Exam tab presenting a multiple-choice question built from live simulator prices
Exam practice. Multiple-choice questions in the style of the Dealing Certificate, built from the live prices, with an explanation after each answer and a score by topic.

Screenshots are from a demonstration copy of the simulator. All prices, banks, clients and amounts are simulated; the banks are fictional.

Life of a deal

  1. Price. Eight banks quote two-way prices around the market mid. In a conversation you ask for a price: EUR 10 → 1.1203/05.
  2. Deal. MINE buys at 1.1205. The bank confirms: TO CONFIRM AT 1.1205 I SELL 10 MIO EUR VAL 13OCT26 · MY USD TO ATLB NY.
  3. Position. The position, average rate and open P&L update at once; limits are checked.
  4. Ticket. The back office captures a ticket: trade date, value date, both currency amounts.
  5. Confirmation. The counterparty's confirmation arrives seconds later and is matched. About one in twenty disagrees and becomes an exception.
  6. End of day. At 17:00 New York, positions are revalued at closing rates, P&L and carry are posted, and the business date rolls forward.
  7. Settlement. On the value date the two currencies move through the nostro accounts and the ticket is marked settled.

Command reference

Commands are typed at the DEAL> prompt and are not case-sensitive. Amounts are in millions of the first currency (gold in thousands of ounces). Tab completes words, and HELP followed by any word explains it with an example.

Dealing conversations

CommandWhat it does
ATLBOpen a conversation with a bank: ATLB, NRDC, MRDN, HLVT, PCFT, CRWN, SKRA, LBTY, or BRKR for the voice broker.
EUR 10Ask for a two-way price in 10 million. Pair words: EUR, CABLE, YEN, SWISSY, AUSSIE, LOONIE, EURGBP, GOLD.
MINE · MINE 5Buy at the bank's offer, all or part of the size.
YOURS · YOURS 5Sell at the bank's bid.
NTGNothing, no deal.
BIBIClose the conversation.
20/22Answer a client who is calling: your bid and offer in pips, or in full as 1.1220/22.
q 7 20 22Answer a specific call when two clients call at once.

Electronic broker and orders

CommandWhat it does
BUY 5 EUR AT BESTBuy now at the best offer. Fast key: b eur 5; from one bank: b eur 5 mrdn.
SELL 5 EUR AT BESTSell now at the best bid. Fast key: s eur 5.
okTake the smaller size a bank offered after “only good for 2 MIO”.
BUY 50 YEN IOCImmediate or cancel: take the size available now, cancel the rest.
SELL 5 EUR AT 1.1250 GTCLimit order, good till cancelled.
SELL 5 EUR STOP 1.1180 GFDStop order, good for the day.
OCO EUR 1.1250 1.1180Take profit and stop loss on the whole position; when one fills, the other is cancelled. Also tp eur 1.1250, sl eur 1.1180.
ORDERS · CXL 3List working orders with their distance in pips; cancel order 3.
sq eurSquare the whole EUR/USD position at best.
d eurDepth: every bank's bid, offer and size.

Forwards, swaps and money markets

CommandWhat it does
FWD EURForward curve: ON, TN, SN, 1W, 2W, 1M, 2M, 3M, 6M, 9M, 1Y with dates, points and outrights.
BUY 5 EUR 3MOutright forward for the 3-month value date.
SWAP B/S EUR 10 1MFX swap: buy near, sell far. S/B is the opposite; TN rolls a position.
MM USDDeposit and loan rates by tenor (you lend at the bid, borrow at the offer).
LEND USD 10 1M · BORROW EUR 5 3MPlace a deposit or take a loan; interest accrues each night.
MMBOOKYour deposits and loans with accrued interest.

Book, back office and study

CommandWhat it does
pos · dealsPositions with average and P&L; recent trades with value dates.
news · tapeRecent headlines; trades between other banks.
BO · CONFBack-office overview and exceptions; all tickets and their status.
MATCH D1010Resolve a confirmation break or a failed settlement.
SETT · NOSTROSettlement ladder by value date; cash per currency at each correspondent bank.
GL · JNL 12 · PNLTrial balance; latest journals; daily P&L history including carry and interest.
EODRun end of day now (it also runs by itself at 17:00 New York).
CHART EUR 5 · CHART OFFCandlestick chart, 1, 5, 15 or 60-minute candles.
QUIZ then A–DExam practice with explanations and a running score.
PERFPerformance report.
HELP · HELP OCOAll help topics by group; one topic with usage and example.
speed 1 · pause · resumeMarket speed (1, 5, 10, 30, 60) and freeze.
HOURS REAL · HOURS ALWAYSClose at weekends like real FX (Friday 17:00 to Sunday 17:00 New York), or stay open.
quitClose the screen; the market keeps running.

How the market works

Price process

Each currency pair follows a random walk scaled to its typical annual volatility (EUR/USD 7%, USD/JPY 10%, gold 15%) over a 252-day trading year. EUR/GBP is derived from EUR/USD and GBP/USD so the crosses never disagree. Prices are pulled back towards their real reference levels with a half-life of about six simulated hours, more firmly beyond ±3%, so the simulation stays close to the real market over time.

Reference data

Currencies anchor to the European Central Bank's daily reference rates; gold anchors to the live spot price. Both refresh every four hours. Money-market rate levels and forward points are computed from simulated interest rates, labelled as such on every screen.

Banks and liquidity

Eight fictional banks quote around the mid with their own spread and size. A bank that is long shades its prices lower, quotes update at different moments, and a quote the market has moved through is refreshed so the best bid never crosses the best offer. Dealing on a stale price, or for more than the size shown, can be refused with last look.

Events

News shocks (central banks, data releases, intervention, risk-off, the occasional flash crash) jump prices and widen spreads, with a one-hour cooldown per currency. Other banks trade with each other on the tape, and clients call at random with sizes that fit their type.

Reproducibility

Randomness comes from a seeded xoshiro128** generator, the same family as C++'s standard generators, so a session can be replayed from its seed.

Limits

50 million per pair (gold 20,000 oz), 150 million net open position, and a USD 250,000 daily stop-loss, with warnings when breached.

Back office & accounting

Spot FX is off-balance-sheet between trade date and value date. On the value date each deal settles: the currency bought arrives in its nostro, the currency sold leaves it, and each leg is booked against a currency position account so every journal balances in its own currency. End of day revalues open positions at closing mids and posts the unrealised result in USD, reversed the next day; realised results, tom/next carry and interest are posted alongside.

AccountMeaning
1100 Nostro (per currency)Cash at the correspondent bank: JPMorgan Chase New York (USD), Deutsche Bank Frankfurt (EUR), Barclays London (GBP), MUFG Tokyo, UBS Zurich, Westpac Sydney, RBC Toronto, loco London for gold. Each is pre-funded.
1200 / 2200Money-market deposits placed / deposits taken.
1210 / 2210Interest receivable / payable.
1900 FX positionCurrency position accounts, the other side of each settlement leg.
1950 Revaluation adjustmentMark-to-market of open positions at the last close.
1960 P&L clearingOffset for realised trading results.
3000 CapitalOpening funding of the desk.
4000 / 4100FX trading P&L realised / revaluation P&L unrealised.
4200FX swap carry from the nightly tom/next roll.
4300 / 4310Interest income / interest expense.

Ticket statuses run captured → matched → settled. A break shows as unmatched; if it is still unmatched on the value date the ticket fails and settles late once resolved. Dates follow market conventions: spot is T+2 (USD/CAD T+1), month tenors use modified-following with the end/end rule, and money markets use ACT/360 or ACT/365 by currency.

Architecture

              Mac mini — listens on 127.0.0.1 only
  ┌────────────────────────────────────────────────────┐
  │  server.mjs ── HTTP, event stream, JSON API         │
  │      │                                              │
  │  sim/engine.mjs ── market, banks, orders, risk      │
  │      ├── sim/backoffice.mjs  tickets · settlement · ledger
  │      ├── sim/rates.mjs       tenors · points · money markets
  │      ├── sim/quiz.mjs        exam questions          │
  │      └── data/sim-state.json the live book           │
  └───────────▲───────────────▲───────────────▲────────┘
              │               │               │
      Terminal client   Web dealing room   Formula desk
       (cli/desk.mjs)      (/dealing)     (46 calculators)
  every 4 h ──► ECB reference rates · live gold price

The server is plain Node.js with no third-party packages. The engine ticks four times a second, saves the book every five seconds and on every deal, and pushes a snapshot to every connected screen over a server-sent event stream. Both front ends are thin: they render the snapshot and send commands back as JSON.

ComponentRole
server.mjsStatic files, the event stream, the JSON API, security headers.
sim/engine.mjsMarket dynamics, bank quotes, news, clients, conversations, orders, positions, limits, performance.
sim/backoffice.mjsTickets, confirmations, settlement, end of day, ledger, reports.
sim/rates.mjsTenor dates, forward points, forward and money-market tables.
sim/quiz.mjs · sim/rng.mjsExam questions; seeded random numbers.
cli/desk.mjs · cli/help.mjsTerminal client; the help topics (over 100).
public/Formula desk, web dealing room, offline service worker, KaTeX for formulas.

API reference

All routes live under /api/sim on 127.0.0.1:9300. Requests that change anything must be JSON and carry the header X-Desk: 1; a web page from another site cannot send that header, which protects the local server from cross-site requests.

RoutePurpose
GET /streamServer-sent events: a full snapshot about four times a second.
GET /stateOne full snapshot.
GET /bars?pair=&tf=&n=OHLC candles in simulated minutes.
GET /fwd?pair= · GET /mmq?ccy=Forward curve; money-market rates.
GET /perfPerformance report.
GET /bo/{summary,tickets,nostro,ladder,gl,journal,pnl,mm}Back-office views.
POST /dealDeal on a bank's price: pair, side, amount, bank.
POST /quoteAnswer a client call: id, bid, offer.
POST /chatSend a conversation line to a bank or the broker.
POST /order · /protect · /order/cancelLimit or stop order; take-profit and stop-loss pair; cancel.
POST /forward · /swap · /mmOutright forward; FX swap; deposit or loan.
POST /bo/match · /cancelResolve a break; back-office deal cancellation.
POST /quiz · /quiz/answerNew question; answer it.
POST /controlpause, resume, speed, hours, eod, reset.

Operations

Formula desk

Formula desk showing the FRA settlement calculator with the formula, deal inputs and the result You receive 6,720.26
Formula desk (localhost:9300). The FRA settlement calculator with its formula, inputs, result and the check against the ACI sample question.

Forty-six calculators cover the ACI FMA formula sheet effective 22 June 2026 for the Dealing Certificate (002-101), Operations Certificate (002-201) and Diploma (003-102): spot amounts and cross rates, forward points and outrights, short dates, interpolation, deposits and rollovers, discount instruments and CDs, repo with margin or haircut, forward-forwards, FRAs and single-period swaps, futures, bonds, swaps, options strategies, volatility, VaR and the Basel III ratios. Each shows the formula, an explanation, the working, and can be saved to a blotter. A test script checks the results against every numeric answer in the official sample questions.

Konstas Markets Desk is a training system. Prices are simulated around public reference rates, the banks and clients are fictional, and no real money is involved. ACI and ACI FMA are trademarks of their owners; the formula sheet is referenced for study purposes.

Research and direction by Ioannis (John) Konstas; compiled and finalized with AI assistance.

👁· views