getMktData

Syntax

getMktData(dataSet, type, date, name)

Details

Retrieves the corresponding market data from a dataset for a specified valuation date, based on the market data type and name.

Parameters

dataSet is a set of market data. Supported types:

  • A market data engine created via createMktDataEngine
  • A vector or dictionary representing a set of market data defined by users. The data structure must comply with the market data input specification required by instrumentPricer.

type is a STRING scalar indicating the type of the market data. Supported types:

  • "Price": option underlying price
  • "Curve": Yield curve
  • "Surface": Volatility surface

date is a DATE scalar indicating the reference date.

name is a STRING scalar indicating the name of the market data, such as curve or surface name.

Returns

A MKTDATA scalar.

Examples

This example uses createMktDataEngine to build three types of market data in real time—USD/CNY, EUR/USD, and EUR/CNY—and then uses getMktData to retrieve the spot price data generated by the engine.


try{dropStreamEngine("MKTDATA_ENGINE")}catch(ex){}
referenceDate = 2025.07.01

config1 = {
    "name": "USDCNY",
    "type": "FxSpotRate"
}
config2 = {
    "name": "EURUSD",
    "type": "FxSpotRate"
}
config3 = {
    "name": "EURCNY",
    "type": "FxSpotRate"
}

engine = createMktDataEngine("MKTDATA_ENGINE", referenceDate, [config1, config2, config3])

typeCol = ["FxSpot", "FxSpot", "FxSpot"]
nameCol = ["USDCNY", "EURCNY", "EURUSD"]
priceCol = [7.12, 7.88, 1.10]

data = table(typeCol as type, nameCol as name, priceCol as price)

engine.append!(data)
sleep(100)

re = getMktData(engine, "Price", referenceDate, "USDCNY")
print(re)

Related functions: createMktDataEngine, instrumentPricer