DStream::mktDataEngine
First introduced in version: 3.00.6.1
Syntax
DStream::mktDataEngine(referenceDate, mktDataConfig, [historicalData],
[engineConfig])
Details
Creates a market data engine in Orca for real-time market data construction. The engine receives raw market quotes from the upstream node, builds standardized market data objects according to the specified market data configuration, and passes the results to downstream nodes.
This function is intended for real-time construction of market data such as curves,
surfaces, and exchange rates in FICC scenarios. A typical use case is that an upstream
source continuously writes quote data, while mktDataEngine converts
the quotes into standard market data that can be consumed by pricingEngine
or other downstream nodes.
Parameters
referenceDate is a DATE scalar indicating the reference date of the market data.
mktDataConfig A dictionary or a tuple of dictionaries. Specifies the market data construction configuration. See below for details on the configuration format.
historicalData (optional) is the historical market data. If the required market data cannot be obtained from the engine cache or real-time streams during construction, the engine will retrieve data from this source. It can be:
engineConfig (optional) is a dictionary specifying engine runtime configuration. Supported key-value pairs include:
Returns
A DStream object.
Examples
This example defines a stream graph that feeds an input table of raw FX quotes (fx_in) into the market data engine. Based on the configured asset type (FxSpotRate), the engine converts the input into standardized financial objects that can be consumed directly by downstream pricing engines, and writes the result to the output table mkt_out.
if (!existsCatalog("orca")) {
createCatalog("orca")
}
go
use catalog orca
// Define a stream graph: input -> market data engine -> output
fxConfig = {"name": "USDCNY", "type": "FxSpotRate"}
g = createStreamGraph("simple_mkt_graph")
g.source(`fx_in, `type`name`price, [STRING, STRING, DOUBLE])
.mktDataEngine(2025.01.01, fxConfig)
.sink("mkt_out")
g.submit()
// Ingest one raw market quote
fxQuote = table("FxSpot" as type, "USDCNY" as name, 7.12 as price)
appendOrcaStreamTable("fx_in", fxQuote)
// Query the standardized result
select * from useOrcaStreamTable("mkt_out", t -> select * from t)
Related functions: DStream::pricingEngine, createMktDataEngine
