Sign inSign up

markccchiang/ql-app

By markccchiang

•Updated 20 days ago

QuantLib pricing workbench for options and swaps in the browser, built from source

Image
Data science
0

186

markccchiang/ql-app repository overview

Interactive QuantLib Service

⁠Interactive QuantLib Service

A browser workbench for pricing options and interest-rate swaps, backed by QuantLib⁠ running as a live, stateful service.

The service keeps each session's QuantLib object graph standing between requests: the curves, the volatility, the index and the instrument. Moving a quote therefore reprices off the graph that already exists instead of rebuilding it, so dragging the spot slider updates the price immediately.

This image contains the whole application, built from source: ql-backend⁠ (the C++ WebSocket pricing service, on QuantLib 1.43), ql-frontend⁠ (the React app) and its user's guide in English and Traditional Chinese.

⁠Quick start

docker run --rm -p 127.0.0.1:8080:8080 markccchiang/ql-app

Open http://localhost:8080⁠. The Guide button in the status bar opens the user's guide.

Keep the 127.0.0.1: prefix. The pricing service has no authentication, and publishing the port on all interfaces would let anyone on your network use it.

⁠Tags

TagContents
latestthe most recent build of ql-backend and ql-frontend main
0.1.0the build published that day; it never moves, so use it to stay on a known version

Each tag is published for linux/amd64 and linux/arm64, so it runs natively on Intel/AMD machines and on Apple Silicon.

⁠Configuration

⁠Another port or host name

The service accepts a WebSocket only from browser origins it has been told about. The defaults are http://localhost:8080 and http://127.0.0.1:8080. If you publish another port or reach the container under another name, set QL_ALLOWED_ORIGINS (space-separated):

docker run --rm -p 127.0.0.1:9000:8080 \
    -e QL_ALLOWED_ORIGINS="http://localhost:9000 http://127.0.0.1:9000" \
    markccchiang/ql-app

Without it, the page loads but the status bar reports the service as running, but refusing this page.

⁠Service options

Arguments after the image name are passed to ql-backend:

docker run --rm -p 127.0.0.1:8080:8080 markccchiang/ql-app --max-sessions 8
OptionMeaning
--max-sessions Nthe most live pricing sessions at once
--max-connections Nthe most WebSocket connections at once
--session-grace SECONDShow long a session outlives a dropped connection so the page can resume it (default 60, 0 turns it off)
⁠Running it in the background
docker run -d --name ql-app --restart unless-stopped \
    -p 127.0.0.1:8080:8080 markccchiang/ql-app

The image has a health check. docker ps shows the container as healthy once the service is answering, and curl http://localhost:8080/ws/healthz shows its status. docker stop shuts it down cleanly.

⁠What is inside

Port8080: nginx serves the app and the guide, and passes /ws/ to the service
Pricing serviceql-backend, listening on loopback inside the container only
LibrariesQuantLib 1.43 (sessions enabled) and Protobuf 34.0, linked statically
Basedebian:trixie-slim, running as the unprivileged user ql under tini

⁠Source, building and issues

The Dockerfile, build instructions and building from your own checkouts are in markccchiang/ql-docker⁠. Report problems with the application to ql-frontend⁠ or ql-backend⁠.

⁠Licence

ql-backend and ql-frontend are MIT-licensed. QuantLib is distributed under its modified BSD licence⁠, and Protobuf under the BSD 3-Clause licence.

Tag summary

Content type

Image

Digest

sha256:c01fc8bb8…

Size

60.2 MB

Last updated

20 days ago

docker pull markccchiang/ql-app