parseMktData
Syntax
parseMktData(dict)
Arguments
dict A dictionary or a STRING scalar representing a JSON-encoded dictionary that defines the market data to be parsed.
Details
Parses the given dictionary or JSON string into MKTDATA type.
Return value: A MKTDATA object.
Supported Market Data and Fields
The MKTDATA type is newly introduced in DolphinDB version 3.00.4, which provides database support for the market data used for pricing.
Currently supported types:
-
Spot prices: FxSpot (foreign exchange spot rate)
-
Term structure curves: IrYieldCurve (interest rate yield curve), AssetPriceCurve (asset price curve)
-
Volatility surfaces: FxVolatilitySurface (foreign exchange volatility surface)
FxSpot
Field Name | Data Type | Description | Required |
---|---|---|---|
mktDataType | STRING | Must be "Spot" | √ |
referenceDate | DATE | Reference Date | √ |
version | INT | Version, default 0 | × |
spotDate | DATE | Spot settlement date. Use internal static data by default. | × |
spotType | STRING | Spot price type. Must be "FxSpot" | √ |
value | DOUBLE | Spot price | √ |
unit | STRING |
Unit for spot prices. Available options: "EURUSD", "USDCNY", "EURCNY", "GBPCNY", "JPYCNY", "HKDCNY". Currency pairs may also use |
√ |
Define a MKTDATA object of FxSpot type.
fxSpot = {
"mktDataType": "Spot",
"referenceDate": 2025.08.18,
"version": 0,
"spotDate": 2025.08.20,
"spotType": "FxSpot",
"value": 7.2659,
"unit": "USDCNY"
}
mktData = parseMktData(fxSpot)
print(mktData)
IrYieldCurve
Field Name | Data Type | Description | Required |
---|---|---|---|
mktDataType | STRING | Must be "Curve" | √ |
referenceDate | DATE | Reference Date | √ |
version | INT | Version, default 0 | × |
curveType | STRING | Must be "IrYieldCurve" | √ |
dayCountConvention | STRING |
The day count convention to use. It can be:
|
√ |
interpMethod | STRING |
Interpolation method. It can be:
|
√ |
extrapMethod | STRING |
Extrapolation method. It can be
|
√ |
dates | DATE vector | Date of each data point | √ |
values | DOUBLE vector | Value of each data point, corresponding to the elements in dates. | √ |
curveName | STRING | Curve name | × |
currency | STRING | Currency. It can be CNY", "USD", "EUR", "GBP", "JPY", "HKD" | √ |
compounding | STRING |
The compounding interest. It can be:
|
√ |
settlement | DATE | Settlement date. If specified, all subsequent tenor intervals are computed starting from "settlement" rather than from "referenceDate". | × |
frequency | INTEGRAL/STRING |
The interest payment frequency. Supported values:
|
× |
curveModel | STRING |
Curve construction model; It can be "Bootstrap" (default), "NS", "NSS". When the value is "NSS" or "NS", the fields interpMethod, extrapMethod, dates, and values are not required. |
× |
curveParams | DICT |
Model parameters. It is required when curveModel is "NSS" or "NS":
|
× |
Define a MKTDATA object of IrYieldCurve type.
aod = 2025.07.01
curve = {
"mktDataType": "Curve",
"curveType": "IrYieldCurve",
"version": 0,
"referenceDate": aod,
"currency": "CNY",
"dayCountConvention": "Actual365",
"compounding": "Continuous",
"interpMethod": "Linear",
"extrapMethod": "Flat",
"dates":[2025.07.07,2025.07.10,2025.07.17,2025.07.24,2025.08.04,2025.09.03,2025.10.09,2026.01.05,
2026.04.03,2026.07.03,2027.01.04,2027.07.05,2028.07.03],
"values":[0.015785,0.015931,0.016183,0.016381,0.016493,0.016503,0.016478,0.016234,0.016321,
0.016378,0.015508,0.015185,0.014901],
"settlement": aod+2
}
mktData = parseMktData(curve)
print(mktData)
IrYieldCurve(non-bond)
Field Name | Data Type | Description | Required |
---|---|---|---|
mktDataType | STRING | Must be "Curve" | √ |
referenceDate | DATE | Reference Date | √ |
version | INT | Version, default 0 | × |
curveType | STRING | Must be "IrYieldCurve" | √ |
dayCountConvention | STRING |
The day count convention to use. It can be:
|
√ |
interpMethod | STRING |
Interpolation method. It can be:
|
√ |
extrapMethod | STRING |
Extrapolation method. It can be
|
√ |
dates | DATE vector | Date of each data point | √ |
values | DOUBLE vector | Value of each data point, corresponding to the elements in dates. | √ |
curveName | STRING | Curve name | × |
currency | STRING | Currency. It can be CNY", "USD", "EUR", "GBP", "JPY", "HKD" | √ |
compounding | STRING |
The compounding interest. It can be:
|
√ |
settlement | DATE | Settlement date. If specified, all subsequent tenor intervals are computed starting from "settlement" rather than from "referenceDate". | × |
frequency | INTEGRAL/STRING |
The interest payment frequency. Supported values:
|
× |
curveModel | STRING |
Curve construction model; Currently, only "Bootstrap" is supported. |
× |
curveParams | DICT | Model parameters. | × |
AssetPriceCurve
Field Name | Data Type | Description | Required |
---|---|---|---|
mktDataType | STRING | Must be "Curve" | √ |
referenceDate | DATE | Reference Date | √ |
version | INT | Version, default 0 | × |
curveType | STRING | Must be "AssetPriceCurve" | √ |
dates | DATE vector | Date of each data point | √ |
values | DOUBLE vector | Value of each data point, corresponding to the elements in dates. | √ |
curveName | STRING | Curve name | × |
Define a MKTDATA object of AssetPriceCurve type.
curve = {
"mktDataType": "Curve",
"curveType": "AssetPriceCurve",
"version": 0,
"referenceDate": 2024.06.28,
"curveName": "PRICE_SHIBOR_3M",
"dates": [2024.06.21, 2024.06.24, 2024.06.25, 2024.06.26,2024.06.27],
"values": [1.923, 1.922, 1.921, 1.919, 1.918]/100
}
mktData = parseMktData(curve)
print(mktData)
FxVolatilitySurface
Field Name | Data Type | Description | Required |
---|---|---|---|
mktDataType | STRING | Must be "Surface" | √ |
referenceDate | DATE | Reference Date | √ |
version | INT | Version, default 0 | × |
surfaceType | STRING | Must be "FxVolatilitySurface" | √ |
smileMethod | STRING |
Volatility smile method. It can be:
|
√ |
volSmiles | DICT(STRING, ANY)vector |
Volatility smiles vector. Each element is one smile . It has the following members:
|
√ |
termDates | DATE vector | Term date corresponding to each smile in volSmiles. | √ |
surfaceName | STRING | Surface name | × |
currencyPair | STRING |
Foreign exchange currency pair. Available options: "EURUSD", "USDCNY", "EURCNY", "GBPCNY", "JPYCNY", "HKDCNY". Currency pairs may also use |
√ |
Define a MKTDATA object of FxVolatilitySurface type.
surf = {
"surfaceName": "USDCNY",
"mktDataType": "Surface",
"surfaceType": "FxVolatilitySurface",
"version": 0,
"referenceDate": "2025.08.18",
"smileMethod": "Linear",
"termDates": [
"2025.08.21",
"2026.08.20"
],
"volSmiles":[{"strikes": [6.5,7,7.5],"vols": [0.1,0.1,0.1]},{"strikes": [6.5,7,7.5],"vols": [0.1,0.1,0.1]}],
"currencyPair": "USDCNY"
}
surfUsdCny = parseMktData(surf)