Skip to content

Compose the presentation

An operator client composes every presentation fragment it shows into one Presentation (Value presentation), then asks it for a value's kinds and representations.

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);