Presentation
How operator clients (the TUI, the web app) show a Value, a state entry or an event: its kinds, decided from the instance by rules, and each kind's value and stream representations (openspec value-presentation). The rules are data, shipped as presentation fragments by the owner of the payloads they describe:
| Fragment | Package | Kinds |
|---|---|---|
virtufin.indicator |
indicator-devkit | tradeflow, bookimbalance, indicator.value |
virtufin.market |
market-data-devkit | orderbook (decoder orderbook.image) |
virtufin.values |
domain-devkit | number, text, json.object, json.array, * |
A fragment is a representations document (presentation/<id>.json, schema
presentation/representations.schema.json) with its decoders (code, for binary formats a rule
cannot describe) and its conformance vectors (presentation/<id>.kinds.yaml). The composed
mapping is the owners' fragments by id, then the generic one; a user's document matches first and
its lists replace the shipped lists of their kinds. A kind defined twice is reported and the later
one ignored.
Python
Packages announce their fragment with the virtufin.presentation entry point (their
presentation/ directory, decoders in the module's PRESENTATION_DECODERS):
from virtufin.domain_devkit.representations import Presentation
presentation = Presentation.load(user_document) # every installed fragment
presentation.kinds_of(value) # ["orderbook", "json.object", "*"]
presentation.value_entries(value) # orderbook.ladder, json.tree, json.text, text
presentation.stream_entries(newest) # latest, log
TypeScript
There is no discovery: list the devkits' PRESENTATION exports; the generic fragment is added:
import { Presentation } from "@virtufin/domain-devkit";
import { PRESENTATION as MARKET } from "@virtufin/marketdata-devkit";
import { PRESENTATION as INDICATOR } from "@virtufin/indicator-devkit";
const presentation = Presentation.compose([MARKET, INDICATOR], userDocument);
Vectors
Every client runs every vector of the fragments it composes, from the installed packages: each
fragment's <id>.kinds.yaml, and this package's filter.yaml, worker-filter.yaml and
name-tree.yaml (the filter language and the name tree are implemented by the clients).