parseInstrument

First introduced in version: 3.00.4

Syntax

parseInstrument(obj)

Details

Parse the instrument description obj into an INSTRUMENT object for modeling and pricing. See Supported Instruments and Fields for details.

Note: parseInstrument preserves non-standard scalar or vector fields (i.e., fields not defined as attributes of the financial instrument) during serialization or deserialization.

Parameters

obj is a dictionary, a tuple of dictionaries, an in-memory table, or a STRING scalar/vector, indicating the financial instrument description to be parsed.

Note: If obj is specified as a table, it must store instruments of a single type.

Returns

An INSTRUMENT object.

Examples

Store the description of a coupon bond in a dictionary and use parseInstrument to parse it into an INSTRUMENT object.

bond = {
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "FixedRateBond",
    "instrumentId": "230205.IB",
    "start": "2023.03.06",
    "maturity": "2033.03.06",
    "issuePrice": 100.0,
    "coupon": 0.0302,
    "calendar": "CFET",
    "frequency": "Annual",
    "dayCountConvention": "ActualActualISDA",
    "subType": "CDB_BOND",
    "issuer": "CDB"
}
parseInstrument(bond)

Parse a tuple of dictionaries and obtain INSTRUMENT objects for three bonds.

bond1 = {
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "DiscountBond",
    "instrumentId": "259924.IB",
    "start": 2025.04.17,
    "maturity": 2025.07.17,
    "issuePrice": 99.664,
    "dayCountConvention": "ActualActualISDA",
    "subType": "TREASURY_BOND",
    "issuer": "MOF"
}

bond2 = {
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "ZeroCouponBond",
    "instrumentId": "250401.IB",
    "start": 2025.01.09,
    "maturity": 2026.02.05,
    "coupon": 0.0119,
    "dayCountConvention": "ActualActualISDA",
    "subType": "CDB_BOND",
    "issuer": "ADBC"
}

parseInstrument([bond,bond1,bond2])

Store instrument descriptions in a table, with each column representing a field. Use parseInstrument to parse it and obtain an INSTRUMENT object.

Note: If a product is missing a field required by the table columns, set that field to NULL when inserting the product into the table.

create table t (
    productType STRING,
    assetType STRING,
    bondType STRING,
    version INT,
    instrumentId STRING,
    start DATE,
    maturity DATE,
    issuePrice DOUBLE,
    coupon DOUBLE,
    calendar STRING,
    frequency STRING,
    dayCountConvention STRING,
    subType STRING,
    issuer STRING
)
go

insert into t values( "Cash", "Bond", "FixedRateBond", 0, "230205.IB", 2023.03.06, 2033.03.06, 100.0, 0.0302, "CFET", "Annual", "ActualActualISDA", "CDB_BOND", "CDB")
insert into t values( "Cash", "Bond", "DiscountBond", 0, "259924.IB", 2025.04.17, 2025.07.17, 99.664, NULL, NULL, NULL, "ActualActualISDA", "TREASURY_BOND", "MOF")
insert into t values( "Cash", "Bond", "ZeroCouponBond", 0, "250401.IB", 2025.01.09, 2026.02.05, NULL, 0.0119, NULL, NULL, "ActualActualISDA", "CDB_BOND", "ADBC")

parseInstrument(t)

When obj is a STRING scalar:

bond1Str = '{"productType": "Cash","assetType": "Bond","bondType": "FixedRateBond","coupon": 0.0302,"frequency": "Annual","version": 0,"instrumentId": "230205.IB","nominal": 100,"start": "2023.03.06","maturity": "2033.03.06","dayCountConvention": "ActualActualISDA","calendar": "CFET","currency": "CNY","discountCurve": "","spreadCurve": "","subType": "CDB_BOND","issuePrice": 100,"issuer": "CDB"}'

parseInstrument(bond1Str)

When obj is a STRING vector, parse it and obtain multiple INSTRUMENT objects:

bond2Str = '{"productType": "Cash","assetType": "Bond","bondType": "DiscountBond","issuePrice": 99.664000000000001,"version": 0,"instrumentId": "259924.IB","nominal": 100,"start": "2025.04.17","maturity": "2025.07.17","dayCountConvention": "ActualActualISDA","calendar": "","currency": "CNY","discountCurve": "","spreadCurve": "","subType": "TREASURY_BOND","issuer": "MOF"}'
bond3Str = '{"productType": "Cash","assetType": "Bond","bondType": "ZeroCouponBond","coupon": 0.0119,"version": 0,"instrumentId": "250401.IB","nominal": 100,"start": "2025.01.09","maturity": "2026.02.05","dayCountConvention": "ActualActualISDA","calendar": "","currency": "CNY","discountCurve": "","spreadCurve": "","subType": "CDB_BOND","issuer": "CDB"}'

parseInstrument([bond1Str,bond2Str,bond3Str])

Supported Instruments and Fields

The INSTRUMENT type is newly introduced in DolphinDB version 3.00.4, designed to store financial instruments and provide a foundation for pricing and risk measurement of financial products.

The parseInstrument function generates corresponding instrument objects based on the fields of the instrument description. Currently, only the following instrument types are supported:

Discount Bond (DiscountBond)

Field Name Data Type Description Required
productType STRING Must be "Cash"
assetType STRING Must be "Bond"
bondType STRING Must be "DiscountBond"
nominal DOUBLE Nominal amount, defalut 100 ×
instrumentId STRING Bond code, e.g., "259926.IB" ×
start DATE Value date
maturity DATE Maturity date
dayCountConvention STRING The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360"
issuePrice DOUBLE Issue price
currency STRING Currency, defaults to "CNY" ×
discountCurve STRING The discount curve, e.g., "CNY_TRASURY_BOND" ×
spreadCurve STRING The credit spread curve ×
subType STRING

Subtypes. China's bonds include:

  • "TREASURY_BOND": Treasury Bonds

  • "CENTRAL_BANK_BILL": Central Bank Bills

  • "CDB_BOND": Policy Bank Financial Bonds (China Development Bank)

  • "EIBC_BOND": Policy Bank Financial Bonds (Export-Import Bank of China)

  • "ADBC_BOND": Policy Bank Financial Bonds (Agricultural Development Bank of China)

  • "MTN": Medium-term Notes

  • "CORP_BOND": Corporate Bonds

  • "UNSECURED_CORP_BOND": Unsecured Corporate Bonds

  • "SHORT_FIN_BOND": Short-term Financing Bills

  • "NCD": Negotiable Certificates of Deposit

  • "LOC_GOV_BOND": Local Government Bonds

  • "COMM_BANK_FIN_BOND": Commercial Bank Financial Bonds

  • "BANK_SUB_CAP_BOND": Bank Subordinated Capital Bonds

  • "ABS": Asset-backed Securities

  • "PPN": Privately Offered Bonds

×
creditRating STRING Credit rating. It can be: "B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", "AAA+" ×

Define an INSTRUMENT object of DiscountBond type.

bond = {
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "DiscountBond",
    "instrumentId": "259924.IB",
    "start": 2025.04.17,
    "maturity": 2025.07.17,
    "issuePrice": 99.664,
    "dayCountConvention": "ActualActualISDA"
}
instrument = parseInstrument(bond)
print(instrument)

Zero Coupon Bond (ZeroCouponBond)

Field Name Data Type Description Required
productType STRING Must be "Cash"
assetType STRING Must be "Bond"
bondType STRING Must be "ZeroCouponBond"
nominal DOUBLE Nominal amount, defalut 100 ×
instrumentId STRING Bond code, e.g., "259926.IB" ×
start DATE Value date
maturity DATE Maturity date
coupon DOUBLE Coupon rate, e.g., 0.03 means 3%
frequency STRING Frequency of interest payment ×
dayCountConvention STRING The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360"
currency STRING Currency, defaults to "CNY" ×
discountCurve STRING The discount curve, e.g., "CNY_TRASURY_BOND" ×
spreadCurve STRING The credit spread curve ×
subType STRING

Subtypes. China's bonds include:

  • "TREASURY_BOND": Treasury Bonds

  • "CENTRAL_BANK_BILL": Central Bank Bills

  • "CDB_BOND": Policy Bank Financial Bonds (China Development Bank)

  • "EIBC_BOND": Policy Bank Financial Bonds (Export-Import Bank of China)

  • "ADBC_BOND": Policy Bank Financial Bonds (Agricultural Development Bank of China)

  • "MTN": Medium-term Notes

  • "CORP_BOND": Corporate Bonds

  • "UNSECURED_CORP_BOND": Unsecured Corporate Bonds

  • "SHORT_FIN_BOND": Short-term Financing Bills

  • "NCD": Negotiable Certificates of Deposit

  • "LOC_GOV_BOND": Local Government Bonds

  • "COMM_BANK_FIN_BOND": Commercial Bank Financial Bonds

  • "BANK_SUB_CAP_BOND": Bank Subordinated Capital Bonds

  • "ABS": Asset-backed Securities

  • "PPN": Privately Offered Bonds

×
creditRating STRING Credit rating. It can be: "B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", "AAA+" ×

Define an INSTRUMENT object of ZeroCouponBond type.

dict = {
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "ZeroCouponBond",
    "instrumentId": "250401.IB",
    "start": 2025.01.09,
    "maturity": 2026.02.05,
    "coupon": 0.0119,
    "dayCountConvention": "ActualActualISDA"
}

Fixed Rate Bond (FixedRateBond)

Field Name Data Type Description Required
productType STRING Must be "Cash"
assetType STRING Must be "Bond"
bondType STRING Must be "FixedRateBond"
nominal DOUBLE Nominal amount, defalut 100 ×
instrumentId STRING Bond code, e.g., "259926.IB" ×
start DATE Value date
maturity DATE Maturity date
coupon DOUBLE Coupon rate, e.g., 0.03 means 3%
frequency STRING Frequency of interest payment
dayCountConvention STRING The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360"
currency STRING Currency, defaults to "CNY" ×
discountCurve STRING The discount curve, e.g., "CNY_TRASURY_BOND" ×
spreadCurve STRING The credit spread curve ×
subType STRING

Subtypes. China's bonds include:

  • "TREASURY_BOND": Treasury Bonds

  • "CENTRAL_BANK_BILL": Central Bank Bills

  • "CDB_BOND": Policy Bank Financial Bonds (China Development Bank)

  • "EIBC_BOND": Policy Bank Financial Bonds (Export-Import Bank of China)

  • "ADBC_BOND": Policy Bank Financial Bonds (Agricultural Development Bank of China)

  • "MTN": Medium-term Notes

  • "CORP_BOND": Corporate Bonds

  • "UNSECURED_CORP_BOND": Unsecured Corporate Bonds

  • "SHORT_FIN_BOND": Short-term Financing Bills

  • "NCD": Negotiable Certificates of Deposit

  • "LOC_GOV_BOND": Local Government Bonds

  • "COMM_BANK_FIN_BOND": Commercial Bank Financial Bonds

  • "BANK_SUB_CAP_BOND": Bank Subordinated Capital Bonds

  • "ABS": Asset-backed Securities

  • "PPN": Privately Offered Bonds

×
creditRating STRING Credit rating. It can be: "B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", "AAA+" ×

Define an INSTRUMENT object of FixedRateBond type.

bond = {
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "FixedRateBond",
    "instrumentId": "240021.IB",
    "start": 2024.10.25,
    "maturity": 2025.10.25,
    "issuePrice": 100,
    "coupon": 0.0133,
    "frequency": "Annual",
    "dayCountConvention": "ActualActualISDA"
}
instrument = parseInstrument(bond)
print(instrument)

Floating Rate Bond (FloatingRateBond)

Field Name Data Type Description Required
productType STRING Must be "Cash"
assetType STRING Must be "Bond"
bondType STRING Must be "FloatingRateBond"
nominal DOUBLE Nominal amount. The default value is 100. ×
instrumentId STRING Bond code, e.g., "1680437.IB" ×
start DATE Value date
maturity DATE Maturity date
iborIndex STRING Reference rate, e.g., "LPR_1Y"
lastFixing DOUBLE Reference-rate fixing from the previous fixing date
spread DOUBLE Spread. The default value is 0.0. ×
frequency STRING Coupon payment frequency
dayCountConvention STRING Day count convention: "ActualActualISDA", "ActualActualISMA", "Actual365", or "Actual360"
fixingOffsetDays INT Number of days between the next accrual start date and the fixing date. The default value is 1. ×
currency STRING Currency. The default value is "CNY". ×
discountCurve STRING Name of the discount curve used for pricing, e.g., "CNY_TREASURY_BOND" ×
spreadCurve STRING Name of the credit spread curve used for pricing ×
forwardCurve STRING Name of the forward curve used for pricing ×
subType STRING

Bond subtype. Supported Chinese bond subtypes are:

  • "TREASURY_BOND": Treasury bond

  • "CENTRAL_BANK_BILL": Central bank bill

  • "CDB_BOND": Policy bank bond issued by China Development Bank

  • "EIBC_BOND": Policy bank bond issued by the Export-Import Bank of China

  • "ADBC_BOND": Policy bank bond issued by the Agricultural Development Bank of China

  • "MTN": Medium-term note

  • "CORP_BOND": Corporate bond

  • "UNSECURED_CORP_BOND": Unsecured corporate bond

  • "SHORT_FIN_BOND": Short-term financing bill

  • "NCD": Negotiable certificate of deposit

  • "LOC_GOV_BOND": Local government bond

  • "COMM_BANK_FIN_BOND": Commercial bank financial bond

  • "BANK_SUB_CAP_BOND": Bank subordinated capital bond

  • "ABS": Asset-backed security

  • "PPN": Privately placed note

×
creditRating STRING Credit rating: "B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", or "AAA+" ×

Define and parse a floating-rate bond:

floatingBond = {
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "FloatingRateBond",
    "instrumentId": "240025.IB",
    "start": 2017.09.11,
    "maturity": 2020.09.11,
    "frequency": "Semiannual",
    "dayCountConvention": "Actual365",
    "iborIndex": "LPR_1Y",
    "spread": 0.02,
    "lastFixing": 0.08
}
typestr(parseInstrument(floatingBond))
// output: INSTRUMENT

Bond Futures (BondFutures)

Field Name Data Type Description Required
productType STRING Must be "Futures"
futuresType STRING Must be "BondFutures"
nominal DOUBLE Nominal amount, defalut 100 ×
instrumentId STRING Bond future code, e.g., "T2509" ×
maturity DATE Maturity date
settlement DATE Settlement date
underlying Dictionary Fixed-rate bond structure, indicating the underlying deliverable bonds.
nominalCouponRate DOUBLE Nominal coupon rate

Define an INSTRUMENT object of BondFutures type.

bond ={
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "FixedRateBond",
    "instrumentId": "220010.IB",
    "start": 2020.12.25,
    "maturity": 2031.12.25,
    "issuePrice": 100.0,
    "coupon": 0.0149,
    "frequency": "Annual",
    "dayCountConvention": "ActualActualISDA"
}

futures =  {
    "productType": "Futures",
    "futuresType": "BondFutures",
    "instrumentId": "T2509",  //Future code
    "nominal": 100.0,
    "maturity": "2022.09.09",
    "settlement": "2022.09.11",
    "underlying": bond,
    "nominalCouponRate": 0.03  //Nominal coupon rate corresponding to the bond futures. You can get it from the China Financial Futures Exchange (CFFEX).
}
instrument = parseInstrument(futures)
print(instrument)

Bond Outright Repo (BondOutrightRepo)

Field Name Type Description Required
productType STRING Set this field to "Cash". Yes
assetType STRING Set this field to "Repo". Yes
repoType STRING Set this field to "BondOutrightRepo". Yes
notionalAmount DOUBLE Notional amount Yes
notionalCurrency STRING Notional currency, defaults to "CNY" No
instrumentId STRING User-defined unique identifier, such as "repo000002" No
start DATE Interest start date Yes
maturity DATE Maturity date Yes
rate DOUBLE Repo rate Yes
payReceive STRING Payment/receipt indicator; "Pay" indicates the repo side, and "Receive" indicates the reverse repo side Yes
underlying DICT/INSTRUMENT Basic information about the pledged bonds Yes
dayCountConvention STRING Day count convention. Valid values are "ActualActualISDA", "ActualActualISMA", "Actual365", and "Actual360". Yes
discountCurve STRING Name of the discount curve used as a pricing reference; for CNY deposits, the default is "CNY_FR_007". No

Bond Pledged Repo (BondPledgedRepo)

Field Type Description Required
productType STRING Fixed value: "Cash". Yes
assetType STRING Fixed value: "Repo". Yes
repoType STRING Fixed value: "BondPledgedRepo". Yes
notionalAmount DOUBLE The notional amount. Yes
notionalCurrency STRING The notional currency. The default value is "CNY". No
instrumentId STRING A user-defined unique identifier, such as "repo000001". No
start DATE The start date. Yes
maturity DATE The maturity date. Yes
rate DOUBLE The repo rate. Yes
payReceive STRING The pay/receive indicator. "Pay" indicates the repo party, and "Receive" indicates the reverse repo party. Yes
dayCountConvention STRING The day count convention. Valid values are "ActualActualISDA", "ActualActualISMA", "Actual365", and "Actual360". Yes
discountCurve STRING The name of the discount curve used for pricing. For CNY scenarios, the default value is "CNY_FR_007". No

Deposit (Deposit)

Field Name Data Type Description Required
productType STRING Must be "Cash"
assetType STRING Must be "Deposit"
notionalAmount DOUBLE Notional principal amount
notionalCurrency STRING Notional principal
instrumentId STRING Deposit reference rate index, e.g., "SHIBOR_3M" ×
start DATE Value date
maturity DATE Maturity date
rate DOUBLE Deposit interest rate
dayCountConvention STRING The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360"
payReceive STRING Pay/Receive indicator: "Pay" indicates paying; "Receive" indicates receiving.
discountCurve STRING The domestic discount curve. The default is "CNY_FR_007" for CNY. ×
calendar STRING Trading calendar ×

Define an INSTRUMENT object of Deposit type.

deposit =  {
    "productType": "Cash",
    "assetType": "Deposit",
    "start": 2025.05.15,
    "maturity": 2025.08.15,
    "rate": 0.02,
    "dayCountConvention": "Actual360",
    "notionalCurrency": "CNY",
    "notionalAmount": 1E6,
    "payReceive": "Receive"
}
instrument = parseInstrument(deposit)
print(instrument)

IR Fixed-Floating Swap (IrFixedFloatingSwap)

Field Name Data Type Description Required
productType STRING Must be "Swap"
swapType STRING Must be "IrSwap"
irSwapType STRING Must be "IrFixedFloatingSwap"
notionalAmount DOUBLE Notional principal amount
notionalCurrency STRING Notional principal
instrumentId STRING IR fixed-floating swap name. It can be "CNY_FR_007 or "CNY_SHIBOR_3M". ×
start DATE Value date
maturity DATE Maturity date
fixedRate DOUBLE Fixed-rate
calendar STRING Trading calendar
fixedDayCountConvention STRING The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360"
floatingDayCountConvetion STRING The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360"
spread DOUBLE Interest rate spread
iborIndex STRING Floating reference rate. It can be "FR_007" or "SHIBOR_3M".
frequency STRING Frequency of interest payment
payReceive STRING

Pay/Receive indicator

  • "Pay": pay fixed interest rate/ receive floating interest rate

  • "Receive": receive fixed interest rate/ pay floating interest rate

discountCurve STRING The discount curve name ×
forwardCurve STRING Name of the forward curve used to project future floating rates ×

Define an INSTRUMENT object of IrFixedFloatingSwap type.

swap =  {
    "productType": "Swap",
    "swapType": "IrSwap",
    "irSwapType": "IrFixedFloatingSwap",
    "start": 2021.05.15,
    "maturity": 2023.05.15,
    "frequency": "Quarterly",
    "fixedRate": 0.02,
    "calendar": "CFET", 
    "fixedDayCountConvention": "Actual365",
    "floatingDayCountConvention": "Actual360",
    "payReceive": "Pay",
    "iborIndex": "SHIBOR_3M",
    "spread": 0.0005,
    "notionalCurrency": "CNY",
    "notionalAmount": 1E8
}
instrument = parseInstrument(swap)
print(instrument)

Foreign Exchange Forward (FxForward)

Field Name Data Type Description Required
productType STRING Product name. It must be "Forward".
forwardType STRING Foreign exchange forward type. It must be "FxForward".
notionalAmount DOUBLE Notional principal amount
notionalCurrency STRING Notional principal
instrumentId STRING InstrumentId ID ×
expiry DATE Value date
delivery DATE Settlement date
currencyPair STRING

The currency pair, in the format "EURUSD", "EUR.USD", or "EUR/USD". Supported currency pairs include:

  • "EURUSD": Euro to US Dollar

  • "USDCNY": US Dollar to Chinese Yuan

  • "EURCNY": Euro to Chinese Yuan

  • "GBPCNY": British Pound to Chinese Yuan

  • "JPYCNY": Japanese Yen to Chinese Yuan

  • "HKDCNY": Hong Kong Dollar to Chinese Yuan

direction STRING Trading direction, can be "Buy" or "Sell"
strike DOUBLE Strike price
domesticCurve STRING The domestic discount curve name ×
foreignCurve STRING The foreign discount curve name ×

Define an INSTRUMENT object of FxForward type.

forward =  {
   "productType": "Forward",
    "forwardType": "FxForward",
    "expiry": 2025.09.24,
    "delivery": 2025.09.26,
    "currencyPair": "USDCNY",
    "direction": "Buy",
    "notionalCurrency": "USD",
    "notionalAmount": 1E8,
    "strike": 7.2
}
instrument = parseInstrument(forward)
print(instrument)

Foreign Exchange Swap (FxSwap)

Field Name Data Type Description Required
productType STRING Product name. It must be "Swap".
swapType STRING Foreign exchange swap type. It must be "FxSwap".
notionalAmount DOUBLE Notional principal amount
notionalCurrency STRING Notional principal
currencyPair STRING

The currency pair, in the format "EURUSD", "EUR.USD", or "EUR/USD". Supported currency pairs include:

  • "EURUSD": Euro to US Dollar

  • "USDCNY": US Dollar to Chinese Yuan

  • "EURCNY": Euro to Chinese Yuan

  • "GBPCNY": British Pound to Chinese Yuan

  • "JPYCNY": Japanese Yen to Chinese Yuan

  • "HKDCNY": Hong Kong Dollar to Chinese Yuan

nearExpiry DATE Maturity date for the near leg
nearDelivery DATE Settlement date for the near leg
direction STRING

Trading direction, can be

  • "Buy": Buy the foreign currency on the near leg and sell it on the far leg.

  • "Sell": Sell the foreign currency on the near leg and buy it back on the far leg.

nearStrike DOUBLE Strike price for the near leg
farExpiry DATE Maturity date for the far leg
farDelivery DATE Settlement date for the far leg
farStrike DOUBLE Strike price for the far leg
domesticCurve STRING The domestic discount curve name ×
foreignCurve STRING The foreign discount curve name ×

Define an INSTRUMENT object of FxSwap type.

swap = {
    "productType": "Swap",
    "swapType": "FxSwap",
    "currencyPair": "EURUSD",
    "direction": "Buy",
    "notionalCurrency": "EUR",
    "notionalAmount": 1E6,
    "nearStrike": 1.1,
    "nearExpiry": 2025.12.08,
    "nearDelivery": 2025.12.10,
    "farStrike": 1.2,
    "farExpiry": 2026.06.08,
    "farDelivery": 2026.06.10
}
instrument = parseInstrument(swap)
print(instrument)

Fx European Style Option (FxEuropeanOption)

Field Name Data Type Description Required
productType STRING Must be "Option"
optionType STRING Must be "EuropeanOption"
assetType STRING Must be "FxEuropeanOption"
notionalAmount DOUBLE Notional principal amount
notionalCurrency STRING Notional principal
instrumentId STRING InstrumentId ID ×
maturity DATE Maturity date
underlying STRING

The currency pair, in the format "EURUSD", "EUR.USD", or "EUR/USD". Supported currency pairs include:

  • "EURUSD": Euro to US Dollar

  • "USDCNY": US Dollar to Chinese Yuan

  • "EURCNY": Euro to Chinese Yuan

  • "GBPCNY": British Pound to Chinese Yuan

  • "JPYCNY": Japanese Yen to Chinese Yuan

  • "HKDCNY": Hong Kong Dollar to Chinese Yuan

direction STRING Trading direction, can be "Buy" or "Sell"
strike DOUBLE Strike price
dayCountConvention STRING The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360"
payoffType STRING Payoff type. It can be "Call" or "Put".
domesticCurve STRING The domestic discount curve name ×
foreignCurve STRING The foreign discount curve name ×
delivery DATE The delivery date ×
Note:

The delivery field is supported starting from version 2.

When upgrading data from versions earlier than version 2 to version 2 or later, missing delivery fields in existing records will be automatically populated with maturity + 2.

Define an INSTRUMENT object of FxEuropeanOption type.

option =  {
    "productType": "Option",
    "optionType": "EuropeanOption",
    "assetType": "FxEuropeanOption",
    "notionalCurrency": "EUR",
    "notionalAmount": 1000000.0,
    "strike": 1.2,
    "maturity": "2025.10.08",
    "payoffType": "Call",
    "dayCountConvention": "Actual365",
    "underlying": "EURUSD"
}
instrument = parseInstrument(option)
print(instrument)

Related functions: bondPricer (Bond Pricing), bondPledgedRepoPricer (Bond Pledged Repo Pricing), irDepositPricer (Deposit Pricing), bondFuturesPricer (Treasury Futures Pricing), fxForwardPricer (FX Forward Pricing), fxSwapPricer (FX Swap Pricing), irFixedFloatingSwapPricer (IR Fixed-Floating Swap Pricing), fxEuropeanOptionPricer (FX European Option Pricing), eqDigitalOptionPricer (Equity Digital Option Pricing)

American Commodity Futures Options (cmFutAmericanOption)

Field Name Type Description Required
productType STRING Fixed value: "Option" Yes
optionType STRING Fixed value: "AmericanOption" Yes
assetType STRING Fixed value: "CmFutAmericanOption" Yes
notionalAmount DOUBLE Notional principal amount Yes
notionalCurrency STRING Notional currency. Default value: "CNY" No
instrumentId STRING Contract code, standard format: Underlying futures contract code + Contract expiry month + Option type code + Strike price, e.g., Sugar option SR2509P6300 = SR+2509+P+6300 No
direction STRING Trading direction. Valid values: “Buy” (default), “Sell”. No
maturity DATE Maturity date Yes
strike DOUBLE Strike price Yes
payoffType STRING Payoff type. Valid values: “Call”, “Put” Yes
underlying STRING Underlying futures contract code, e.g., SR2509 Yes
dayCountConvention STRING Day count convention. Valid values: "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360" Yes
discountCurve STRING Discount curve name for pricing reference. The default value for RMB deposits is "CNY_FR_007". No

European Commodity Futures Options (CmFutEuropeanOption)

Field Name Type Description Required
productType STRING Fixed value: "Option" Yes
optionType STRING Fixed value: "EuropeanOption" Yes
assetType STRING Fixed value: "CmFutEuropeanOption" Yes
notionalAmount DOUBLE Notional principal amount Yes
notionalCurrency STRING Notional currency. Default value: "CNY" No
instrumentId STRING Contract code, standard format: Underlying futures contract code + Contract expiry month + Option type code + Strike price, e.g., Sugar option SR2509P6300 = SR+2509+P+6300 No
direction STRING Trading direction. Valid values: "Buy" (default), "Sell". No
maturity DATE Maturity date Yes
strike DOUBLE Strike price Yes
payoffType STRING Payoff type. Valid values: "Call", "Put" Yes
underlying STRING Underlying futures contract code, e.g., SR2509 Yes
dayCountConvention STRING Day count convention. Valid values: "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360" Yes
discountCurve STRING Discount curve name for pricing reference. The default value for RMB deposits is "CNY_FR_007". No

American Equity Options (eqAmericanOption)

Field Name Data Type Description Required
productType STRING Fixed value: "Option". Yes
optionType STRING Fixed value: "AmericanOption". Yes
assetType STRING Fixed value: "EqAmericanOption". Yes
notionalAmount DOUBLE Notional amount. Yes
notionalCurrency STRING Notional currency. Default value: "CNY". No
instrumentId STRING Instrument identifier. For example, TCH250328C0040000 is interpreted as follows: TCH = underlying (Tencent Holdings); 250328 = maturity date (March 28, 2025); C = Call option; 0040000 = strike price 400.00 HKD. No
direction STRING Trade direction: "Buy" (default) or "Sell". No
maturity DATE Maturity date Yes
strike DOUBLE Strike price. Yes
payoffType STRING Payoff type: "Call" or "Put". Yes
underlying STRING Underlying futures contract code, e.g., "TCH". Yes
dayCountConvention STRING Day count convention. Valid values: "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360" Yes
discountCurve STRING Discount curve name for pricing reference. The default value for RMB deposits is "CNY_FR_007". No
dividendCurve STRING Dividend curve name used for pricing. No

European Equity Options (eqEuropeanOption)

Field Type Description Required
productType STRING Fixed value: "Option" Yes
optionType STRING Fixed value: "EuropeanOption" Yes
assetType STRING Fixed value: “EqEuropeanOption" Yes
notionalAmount DOUBLE Notional amount Yes
notionalCurrency STRING Notional currency. Default value: "CNY". No
instrumentId STRING

Contract identifier, e.g. CSI 500 ETF option

510500C2512M04800

No
direction SRTRING Trade direction: "Buy" (default) or "Sell". No
maturity DATE Maturity date Yes
strike DOUBLE Strike price Yes
payoffType STRING Payoff type: "Call" or "Put". Yes
underlying STRING Underlying contract code, e.g. 510050. Yes
dayCountConvention STRING Day count convention. Valid values: "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360" Yes
discountCurve STRING Discount curve name for pricing reference. The default value for RMB deposits is "CNY_FR_007". No
dividendCurve STRING Name of the dividend curve used for pricing. No

Equity Range Accrual Options (EqRangeAccrualOption)

parseInstrument supports equity range accrual options. The instrument description must contain the following fields:

Field Name Data Type Description Required
productType STRING Must be "Option". Yes
optionType STRING Must be "RangeAccrualOption". Yes
assetType STRING Must be "EqRangeAccrualOption". Yes
instrumentId STRING The instrument ID, which can be customized for OTC options. No
maturity DATE The maturity date. Yes
delivery DATE The delivery date. The default value is maturity. No
coupon DOUBLE The coupon rate. Yes
lowerBarrier DOUBLE The lower boundary of the accrual range. Yes
upperBarrier DOUBLE The upper boundary of the accrual range. Yes
fixingDates DATE vector The fixing date sequence. It must be in ascending order. Yes
direction STRING The buy/sell direction. It can be "Buy" or "Sell". The default value is "Buy". No
dayCountConvention STRING The day count convention. It can be "ActualActualISDA", "ActualActualISMA", "Actual365", or "Actual360". Yes
underlying STRING The underlying name, such as "50ETF". Yes
notionalAmount DOUBLE The notional amount. Yes
notionalCurrency STRING The notional currency. The default value is "CNY". No
discountCurve STRING The name of the discount curve used for pricing. The default value is an empty string. No
dividendCurve STRING The name of the dividend curve used for pricing. The default value is an empty string. No

The following example describes an equity range accrual option with a dictionary and calls parseInstrument to generate an INSTRUMENT object.

option = {
    "productType": "Option",
    "optionType": "RangeAccrualOption",
    "assetType": "EqRangeAccrualOption",
    "instrumentId": "0001",
    "notionalAmount": 1000000.0,
    "notionalCurrency": "CNY",
    "maturity": 2026.06.01,
    "delivery": 2026.06.01,
    "underlying": "50ETF",
    "direction": "Buy",
    "dayCountConvention": "Actual365",
    "lowerBarrier": 2.95,
    "upperBarrier": 3.25,
    "coupon": 0.1,
    "fixingDates": [2026.04.01, 2026.05.01],
    "discountCurve": "CNY_FR_007",
    "dividendCurve": "510050"
}
instrument = parseInstrument(option)
print(instrument)

Equity Digital Options (EqDigitalOption)

parseInstrument supports equity digital options. The instrument description must contain the following fields:

Field Name Data Type Description Required
productType STRING Must be "Option". Yes
optionType STRING Must be "DigitalOption". Yes
assetType STRING Must be "EqDigitalOption". Yes
instrumentId STRING Contract code. For OTC options, it can be customized. No
maturity DATE Maturity date. Yes
strike DOUBLE Strike price. Yes
dayCountConvention STRING Day count convention. It can be "ActualActualISDA", "ActualActualISMA", "Actual365", or "Actual360". Yes
direction STRING Buy/sell direction. It can be "Buy" or "Sell". The default value is "Buy". No
payoffType STRING Payoff type. It can be "Call" or "Put". Yes
underlying STRING Underlying code, for example "510050". Yes
notionalAmount DOUBLE Notional amount. Yes
notionalCurrency STRING Notional currency. The default value is "CNY". No
discountCurve STRING Name of the discount curve used for pricing. The default value is an empty string. No
dividendCurve STRING Name of the dividend curve used for pricing. The default value is an empty string. No