About this demo
This is a small trading desk built on Calseda. It values six client portfolios continuously, watches their risk against limits, keeps option smiles, greeks and carry live, compares prices across exchanges and reviews company filings that affect holdings, all live, from real public market data. This page explains what you are looking at, how the pieces fit together, and what that means for a team that builds calculations like these.
What you are looking at
The desk has five fictional clients, each in a different country and currency: an endowment in the US, a family office in the UK, a foundation in Switzerland, a pension scheme in Germany and a mutual insurer in Japan. Each holds one portfolio of real instruments: US equities, cryptocurrencies, and in one case a listed bitcoin option. Every portfolio is valued in its client's own currency and its value at risk is checked against a limit, continuously.
| Real, live data | Synthetic |
|---|---|
| US equity prices and daily closes (Alpaca, IEX feed) | The six clients and their portfolios |
| Crypto prices on Coinbase, Kraken and Bitstamp | Second-by-second FX rates, simulated around the real ECB reference rates (there is no good free real-time FX feed) |
| Bitcoin option prices, greeks and the BTC and ETH volatility indices (Deribit) | The VaR limit of 4% of portfolio value |
| ECB FX reference rates, NY Fed and ECB overnight rates, the US Treasury curve | |
| Instrument identifiers (OpenFIGI), company filings (SEC EDGAR), legal entities and their parents (GLEIF), trading venues (ISO 10383) |
Two services run it. A feeds service publishes the reference data, the simulated FX and the desk's standing instructions to Kafka. The desk is the Calseda application: it reads those, reads the New York Fed's overnight rates straight from its API, connects to the exchanges and lookup services on demand, and runs the calculations. The console you are in is the desk's built-in view of itself.
Five ideas
Everything on the desk is built from five things.
1 Tasks and workers
A task is a standing instruction, stored as data: "value portfolio P002 in its client's currency", or "watch P003's 1-day 99% value at risk against 4%". For every task, Calseda creates a worker: a long-lived calculation that keeps the answer up to date. Publish a task and a worker starts; change it and the worker is rebuilt; delete it and the worker stops. Nothing is redeployed. Workers can create tasks too: the filing watch raises a review task for each notable filing it finds.
2 Entities
Every piece of data is an entity of a named type, such as a Portfolio, an EquityQuote (a stock's latest price) or an FxRate. Each has an identifier and a current value. Workers ask for entities by type and identifier, and Calseda keeps them supplied with the latest value.
3 Ingress adapters and transformers
Data arrives through ingress adapters. An adapter only moves data: it reads a Kafka topic, holds a WebSocket subscription to an exchange, or calls a lookup service. A transformer, configured per entity type, then decides what each raw message means: which entity it is and its typed value. Keeping the two apart means a new source is a small adapter, a new message format is a small transformer, and neither touches the calculations.
Adapters for live sources subscribe per key. When the first worker asks for AAPL's price, the Alpaca adapter subscribes to AAPL; when no worker has needed it for 30 seconds, it unsubscribes.
4 Identifiers across systems
The same thing has different names in different systems: Apple is AAPL to Alpaca, a FIGI to OpenFIGI, a CIK number to the SEC and, as a legal entity, an LEI to GLEIF. An entity can carry several identifiers, one per naming scheme, and a worker can ask for it by any of them. The filing review uses this to join the SEC's company record to GLEIF's legal entity, which share neither an identifier nor an exact spelling of the name: both are given a normalised legal name, and the join is made on that.
5 Results and egress
A worker's results are entities too. They can be published through egress adapters (here, to Kafka topics and, for alerts, the log), and any other worker can ask for them as inputs. A result asked for by a browser page goes back to that page only.
Discovery and live inputs
Each worker gets its data in two phases, and the difference matters. In discovery, it asks for data step by step, and each answer decides the next question. In live inputs, it names the values its formula uses, and its formula runs again whenever one of them changes.
- Discovery, step 1 The portfolio: which holdings, which client.
- Step 2 The client and, for each stock, its instrument record and trading venue.
- Step 3 The countries of the client and of each venue, which give the currencies.
- Live inputs The price of each holding, and only the FX rates the conversion needs.
If discovery data changes (a holding is added, a client moves), the worker is rebuilt and starts discovery again, so it now watches the new holding's price. If a live input changes (a price ticks), only the formula runs. Open any worker in the console to see both phases drawn as a data flow.
The tasks
The desk runs nine kinds of task here, and four more for derivatives, described in the next section. The diagram shows how these nine connect: whose results each one reads, and which ones a browser page asks for.
Valuation one worker per portfolio
- Answers
- What is this portfolio worth right now, in the client's own currency?
- Discovers
- Step by step, what it needs to know before it can start: the portfolio and its holdings; the client and the country they are in, which decides the currency; and for each share, what exactly it is and where it trades (from OpenFIGI, Bloomberg's open naming system).
- Watches
- The live price of every holding (from Alpaca for shares, Coinbase for crypto, Deribit for options) and only the exchange rates it needs: a US client with only US holdings needs none at all.
- Produces
- PortfolioValuation: each holding's price, where it came from, and its value in the client's currency, recalculated whenever one of them changes.
- Used by
- Value at risk, pre-trade checks, filing reviews, and greeks and scenarios: they all start from this result instead of valuing the portfolio again.
Value at risk one worker per portfolio
- Answers
- How much could this portfolio lose on a bad day? Value at risk (VaR) is the standard answer: the one-day loss that should be exceeded only one day in a hundred. Is it above the limit of 4% of the portfolio's value?
- Watches
- The valuation worker's result, and how much each price tends to swing: for shares, how much they actually moved over the last 30 trading days; for bitcoin and ether, Deribit's DVOL index of the swing the options market expects; for options, how strongly they follow their coin.
- Method
- Each holding's possible loss is worked out from its value and its typical swing, then the losses are simply added up. That ignores holdings that might offset each other, so the figure errs on the side of caution.
- Produces
- VarResult, for each holding and in total; and VarBreach, an alert published only when the portfolio goes over its limit or comes back under it.
Cross-venue spread for bitcoin and ether
- Answers
- Does bitcoin (or ether) cost the same on Coinbase, Kraken and Bitstamp right now, and if not, how far apart are they?
- Watches
- The live price on each of the three exchanges.
- Produces
- CrossVenueSpread: the three prices, the gap between the highest and lowest, and the best price anyone offers to buy or sell at across all three. If one exchange's buyers ever pay more than another's sellers ask, buying on one and selling on the other would make money before fees, and the result says so.
Filing watch one worker for all US holdings
- Answers
- Has any US company the portfolios hold filed an important report with the SEC, the US securities regulator, in the last 30 days? That means quarterly and annual reports, notices of shareholder meetings, and above all 8-Ks: short reports a company must file within days of a major event, such as an acquisition, a change of leadership or a large loss.
- Discovers
- Every US share held in any portfolio, then each company's record at the SEC.
- Watches
- Each company's recent reports, checked at the SEC every 15 minutes during its weekday filing hours, and only while the watch needs them.
- Produces
- New work for other workers: a review task for each notable report, so each gets a worker of its own; an analysis task for each 8-K of the last 90 days, for the AI worker to read; and a short status summary.
Filing review one worker per notable report
- Answers
- Which legal entity filed this report, which group does it belong to, and how much do our clients hold in it now?
- Discovers
- The company as the SEC knows it; then the same company in GLEIF, the global register in which every company active in financial markets has a legal-entity identifier, matched by its legal name (only when the match is confident); then the companies that own it, from the same register.
- Watches
- The live valuations of the portfolios that hold the company.
- Produces
- ReviewAlert, published once, with everything a reviewer needs; and ReviewExposure, what each holding is worth, which follows the market.
Filing analysis an AI worker, one per 8-K
- Answers
- What does this 8-K report say: does it matter to investors, and what happened, was it good or bad news, and how serious is it?
- Discovers
- The written instructions for the model, published separately so analysts can improve them without changing the desk, and any earlier answer for this report, saved on Kafka.
- Watches
- The report's text from the SEC, fetched once. A language model running on the desk's own hardware (Qwen) reads it and must answer by filling in a fixed form; code then checks the answer, for example that every quote it gives as evidence really appears in the report.
- Produces
- FilingAnalysis, saved and reused: the model reads a report only once, unless the model or its instructions change.
Filing impact no AI, from the filing watch or a page
- Answers
- If the share price moved as this report suggests, what would each portfolio holding the company gain or lose, and how much of its daily risk limit would that use up?
- Watches
- The AI worker's reading of the report, and each holding portfolio's live valuation and value at risk.
- Produces
- FilingImpact. The events found are turned into a price move with a fixed table (the more serious the event, the bigger the move), so the same report always gives the same answer; it follows the market as prices change.
What-if valuation private, from a browser page
- Answers
- What would a portfolio that doesn't exist be worth, for a given client, right now?
- How
- The page sends the made-up portfolio as a private task. The same valuation runs for it, from the same live prices, and its results go back to that page only. Close the page and the task and its worker are removed.
Pre-trade check private, from a browser page
- Answers
- If I made this trade, would the portfolio's value at risk go over its limit?
- Watches
- The portfolio's live valuation (another worker's result), the price of what would be traded and how much it tends to swing, and only the exchange rates it needs.
- Produces
- The value at risk before and after the trade, and a verdict, sent to the page. Nothing is traded and nothing is published.
Derivatives
Four kinds of worker turn free market data into the figures a derivatives desk checks every day. They use Deribit, the largest exchange for bitcoin and ether options, plus the US Treasury's yield curve and the New York Fed's overnight dollar rate. Their results are on the Options page. A few ideas first, since everything below builds on them.
A short primer
An option gives its holder the right, but not the duty, to buy (a call) or sell (a put) something at a fixed price, the strike, on a fixed date, the expiry. A bitcoin call with a strike of $90,000 pays off only if bitcoin ends above $90,000; a put with a strike of $70,000 pays off only if it ends below $70,000. Deribit writes these as BTC-27NOV26-90000-C and BTC-27NOV26-70000-P.
Implied volatility. An option pays off most when prices move a lot, so its price tells you how much the market expects the price to swing before the expiry. Turned into a yearly percentage, that is the option's implied volatility: 40% means moves of roughly 40% over a year, or about 11% over a month. It is how traders compare options, much as a yield is how they compare bonds.
The smile. Options on the same date but with different strikes imply different volatilities. Drawn against the strike, they usually form a U-shaped curve: the market pays extra for options that only pay off after a large move. In crypto, protection against falls is usually dearer than bets on rises, so the curve leans to one side.
Futures and the perpetual. A future is a contract to buy or sell at a price agreed now for delivery on a later date. Its price is the market's best estimate of the coin's price on that date, the forward, and options on that date are priced against it. A perpetual is a future that never expires; instead, its buyers and sellers pay each other a small funding rate every 8 hours, which keeps its price close to the coin's.
Volatility smile one worker per expiry date
- Answers
- For one expiry date, what price swing does the market expect at each strike, and are the quoted prices consistent with each other?
- Watches
- Deribit's list of options for that date and the latest prices of each: the mark (Deribit's fair-value estimate) and the best bid and ask (what one could actually sell and buy at). Deribit adds and removes strikes as prices move; the worker's inputs follow the list by themselves.
- Produces
- VolSmile: the implied volatility at each strike; three summary figures (the volatility at the forward, how much dearer protection against falls is than against rises, and how much dearer large moves are than ordinary ones); a smooth curve fitted through the points; and two checks that no combination of the quoted prices would make money whatever happens, with how close the market came. SmileAlert is raised only if such a riskless trade appears.
Term structure one worker per coin
- Answers
- Does the market expect calmer or rougher prices next week than over the next six months, and does that agree with Deribit's own 30-day volatility index, DVOL?
- Watches
- Deribit's expiry dates, and the smile of each. It starts those smile workers itself, one for every date at least two days away (closer dates have too few options and too little time left to measure reliably), and stops them as dates pass: work created by a worker.
- Produces
- VolTermStructure: the volatility at each date, the volatility expected between one date and the next, and a check that the dates' prices don't contradict each other.
Carry one worker per coin
- Answers
- What does owning the coin while selling it for later delivery earn in a year, and is that more than US dollars earn over the same time?
- Watches
- Every Deribit future and the perpetual, the US Treasury yield curve, and SOFR, the overnight rate for borrowing dollars: three free sources in one result.
- Produces
- CarryCurve: for each future, its premium over today's price as a yearly rate, beside the Treasury yield for the same length of time; for the perpetual, its funding as a yearly rate beside SOFR.
Greeks and scenarios one worker per portfolio
- Answers
- How does the value of a portfolio's crypto and options react when prices move, when expected swings change, and as time passes, and what would a large move do?
- Watches
- The valuation worker's result for the portfolio and the option prices it uses, so its figures always agree with the portfolio's value.
- Produces
- PortfolioGreeks, the standard measures: delta, the gain or loss on a 1% move in the coin; gamma, how much that changes on a further 1% move; vega, the gain or loss if expected swings rise by one point; and theta, the value lost in a day as the options' time runs down. And a ScenarioGrid: the gain or loss if the coins moved by up to 20% either way while expected swings changed by up to 10 points, each cell fully recalculated. Portfolio P006 is built to show this: it holds options.
Free data limits this to crypto: live prices for options on shares are sold by the exchanges, and there is no free source for currency options, interest-rate options or credit. The same workers would run on a customer's own data for any of them.
An LLM in the loop
The filing analysis worker is an ordinary Calseda worker that calls a language model. It reads text no deterministic code could, and fills in a fixed form: whether the filing is material, and each event's type, direction, severity and a supporting quote. Nothing else it writes is used.
- Contained. The model only reads real SEC filings: nothing a visitor types reaches it. Its answer is forced into the form, checked again in code, and a quote is shown only if it really appears in the filing.
- Deterministic after it. A fixed table turns the events into a price shock, and ordinary workers apply it to live positions and VaR limits. Those numbers move with the market; the model is not asked again.
- Read once, shared. Each filing is analysed once. The result is stored on Kafka, reused after restarts, and read by every worker and page that needs it, so model calls grow with filings, not with users.
- Tunable without code. The prompt is data, published with the reference data. A new prompt makes the framework recreate the analysis workers, which re-read their filings with it.
Use it from your AI agent
The desk is also an MCP server, so an AI agent can use it directly: see what the desk computes, read live results, ask why a portfolio is over its limit, and run a pre-trade check, a what-if valuation or a filing's impact, privately, as these pages do. The tools and their inputs are generated from the desk's configuration, with no code written for agents. Connect an agent shows how to connect Claude, Cursor, VS Code, Gemini or Codex, and lists the tools. Then ask, for example, "Which portfolio is over its VaR limit, and why?" or "What would buying 1 BTC do to P001's risk?"
Why it stays efficient
A desk like this could easily do far more work than it needs to: stream every instrument, recompute on every message, republish every result. Calseda avoids that in five ways, all visible in this demo.
- Feeds open only on demand
- An exchange subscription exists only while some worker needs that instrument, and is released 30 seconds after the last one stops. Sell a holding and its price feed closes; nobody pays for data nobody uses, and free-tier rate limits go a long way.
- Only the inputs a calculation uses
- Each worker names exactly what its formula reads, so a price tick re-runs only the workers that hold that instrument, and an FX tick only those whose conversion needs that rate.
- Unchanged values do no work
- A republished value that hasn't changed triggers nothing: no recalculation, no rebuild, no new result. A result that comes out the same as last time isn't published again.
- Latest values, not a queue
- When prices move faster than a calculation runs, it doesn't work through a backlog of stale updates. It runs on the latest value of every input and skips the intermediate ones, so results stay current under load instead of falling behind. This is conflation rather than dropping work at random: no input is ever older than its latest value.
- Rebuild only when the shape changes
- Only a change to discovery data, such as a new holding, rebuilds a worker. Price moves never do.
What it means for you
Write the formula, not the plumbing
A new calculation is its lookups and its formula. Finding data, subscribing to feeds, matching identifiers and keeping results current are the framework's job.
Lower data costs
Subscriptions follow what is held and asked, instrument by instrument, so the bill and the rate limits scale with use, not with the size of the universe.
Results that are current
Values, risk and exposures move with the market, and alerts fire the moment a limit is crossed rather than at the next batch.
Questions without a project
What-if and pre-trade questions run as private tasks from a web page, using the same logic and feeds as production, with no new service to build.
Every number is explainable
Each worker shows what it discovered, what it watches, what it produced and when. Its invocations are recorded and can be downloaded for review.
Where it isn't the tool
Windowed analytics over event streams, such as volume in the last five minutes, belong in a stream processor. Calseda sits alongside one, for long-lived calculations over reference data and live prices.
A five-minute tour
- Open Valuation and pick P002. Its data flow shows the three discovery steps and the live inputs: two stock prices, bitcoin and two FX rates, because the client is in the UK and the holdings are priced in dollars.
- Open Value at risk. One or more portfolios are usually above their limit; the result shows each position's contribution and the volatility used.
- Build a portfolio on What-if valuation and watch it value live. Change the client and the currency changes with it.
- On Pre-trade check, try buying bitcoin for a stock-heavy portfolio and see the VaR move against the limit.
- Open Filing review to see recent filings by held companies, matched to their legal entities and parents.
- On Filing analysis, pick a company's earnings 8-K: see what the model found, the shock the rule table gives it, and what that means for each holder against its VaR limit.
- Under Entities, every data type lists its source, and every key its current value.
Simplifications
- US stock prices only move while US markets are open; at other times valuations move with crypto and FX.
- FX is simulated around the ECB's daily reference rates.
- The VaR model is deliberately simple: parametric, per position, with no diversification.
- The filing shock table is illustrative, and earnings are judged against the prior year, not analysts' expectations.
- It is a demo on one machine, not a sizing or performance benchmark.