question

Upvotes
3 0 0 3

Python Refinitiv Data IPA Financial Contract IR Swap intra-day pricing with datetime

I'm trying to price a SOFR swap at intra-day time periods. The documentation implies that a datetime can be provided, however, responses from the service show no valuation differences if a different time is used. See below for example code and outputs.

response = rdf.Definitions(

    universe=[swap.Definition(
        instrument_tag="Example",
        tenor="5Y",
        legs=[swap.LegDefinition(direction=swap.Direction.PAID,
                                 notional_ccy="USD",
                                 interest_payment_frequency=swap.Frequency.QUARTERLY,
                                 interest_type=swap.InterestType.FIXED,
                                 fixed_rate_percent=4.0,
                                 notional_amount=10000000,
                                ),
              swap.LegDefinition(direction=swap.Direction.RECEIVED,
                                 notional_ccy="USD",
                                 index_name="SOFR",
                                 index_tenor = 'ON',
                                 interest_payment_frequency=swap.Frequency.QUARTERLY,
                                 interest_type=swap.InterestType.FLOAT,
                                 notional_amount=10000000,
                                 spread_bp=0
                                )])
    ],
    pricing_parameters=swap.PricingParameters(valuation_date="2024-07-31T13:00:00Z",
                                              report_ccy='USD',
                                              use_legs_signing=True),
    fields=[
        "LegDescription",
        "InstrumentDescription",
        "ValuationDate",
        "FixedRate",
        "Tenor",
        "MarketValueInReportCcy",
        "ErrorMessage"
    ],

).get_data()

response.data.df


1300.png

Same code, but with

valuation_date="2024-07-31T17:00:00Z"

1700.png


python#contentipaswaps
1300.png (11.5 KiB)
1700.png (11.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
6.9k 21 3 6

Hi @Dan.Camp1; I'm afraid that intraday calculations are not available natively in the Refinitiv Data Library (for Python) (RDL) IPA (Instrument Pricing Analytics) module. What I mean by 'natively' is that the IPA API will not fetch intraday data to complete the calculation. For intraday calculations, all data points need to be provided for the calculation; if one is missed, you risk IPA fetching daily data. I did something similar here. For the Swap IPA module, I'm not sure that you can use the content layer. FYI: the RDL is split in three modules going from 'easiest' to 'hardest' (most deconvoluted to most convoluted), the 'Access', 'Content' and 'Delivery' layers. You may have to use the Delivery Layer. I showcase how one may do so in this article. I would advise using the delivery layer and making sure that all fields are sent in your body_parameters's "universe"; matter of fact, it may be easier using the API Playground directly as shown in that article. You may be looking into Option Contracts, in which case I would advise finding the fields to fill in here.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @Dan.Camp1 , I changed "console" in my config file to true as per this article to check the messages sent to RDP endpoints and can confirm that the RDL's IPA module `swap`reaches out to the "api/rdp/data/quantitative-analytics/v1/financial-contracts" endpoint, for which field details can indeed be found here (as per my answer above).

Upvotes
3 0 0 3

Hi @jonathan.legrand, I have tried to implement your suggested approach in the delivery layer, by sending a request to the API directly. However, still doesn't appear to pickup any different market data? Can you confirm that the below is aligned with your suggestions?

API: https://api.refinitiv.com/data/quantitative-analytics/v1/financial-contracts

BODY:

{
  "outputs": [
    "Data",
    "Headers",
    "Statuses"
  ],
  "fields": [
    "InstrumentTag",
    "MarketValueInDealCcy",
    "AccruedAmountInDealCcy",
    "MarketDataDate"
  ],
  "universe": [
    {
      "instrumentType": "Swap",
      "instrumentDefinition": {
        "instrumentTag": "Example",
        "startDate": "2024-06-20T00:00:00Z",
        "tradeDate": "2024-06-20T00:00:00Z",
        "tenor": "1Y",
        "settlementCcy": "USD",
        "isNonDeliverable": "False",
        "legs": [
          {
            "legTag": "A",
            "direction": "Paid",
            "notionalAmount": "1000000",
            "notionalCcy": "USD",
            "interestPaymentFrequency": "Monthly",
            "interestType": "Fixed",
            "notionalExchange": "None",
            "interestCalculationMethod": "Dcb_Actual_360",
            "interestCalculationConvention": "MoneyMarket",
            "paymentBusinessDays": "USA",
            "paymentBusinessDayConvention": "NextBusinessDay",
            "interestPaymentDelay": 2,
            "adjustInterestToPaymentDate": "Unadjusted",
            "fixedRatePercent": 4,
            "paymentRollConvention": "Same",
            "accruedCalculationMethod": "Dcb_Actual_360",
            "firstRegularPaymentDate": "2024-07-20T11:00:00Z",
            "lastRegularPaymentDate": "2025-06-20T11:00:00Z",
            "stubRule": "Maturity"
          },
          {
            "direction": "Received",
            "notionalAmount": "1000000",
            "notionalCcy": "USD",
            "interestPaymentFrequency": "Monthly",
            "interestPaymentDelay": 2,
            "indexResetFrequency": "Everyday",
            "indexResetType": "InArrears",
            "interestType": "Float",
            "notionalExchange": "None",
            "indexSource": "RFTB",
            "indexName": "SOFR",
            "indexTenor": "ON",
            "indexFixingLag": 0,
            "indexLockoutPeriod": 0,
            "indexAverageMethod": "CompoundedActual",
            "interestCalculationMethod": "Dcb_Actual_360",
            "interestCalculationConvention": "MoneyMarket",
            "paymentBusinessDays": "USA",
            "paymentBusinessDayConvention": "NextBusinessDay",
            "paymentRollConvention": "Same",
            "accruedCalculationMethod": "Dcb_Actual_360",
            "adjustInterestToPaymentDate": "Unadjusted",
            "spreadBp": 0,
            "indexPriceSide": "Mid",
            "indexObservationMethod": "Lookback",
            "firstRegularPaymentDate": "2024-07-20T11:00:00Z",
            "lastRegularPaymentDate": "2025-06-20T11:00:00Z",
            "indexCompoundingMethod": "Compounded",
            "stubRule": "Maturity"
          }
        ]
      },
      "pricingParameters": {
        "marketDataDate": "2024-07-31T17:00:00Z",
        "valuationDate": "2024-07-31T17:00:00Z",
        "priceSide": "Mid",
        "useLegsSigning": "True",
        "indexConvexityAdjustmentIntegrationMethod": "RiemannSum",
        "indexConvexityAdjustmentMethod": "BlackScholes",
        "reportCcy": "USD",
        "tenorReferenceDate": "SpotDate"
      }
    }
  ]
}

Response:

InstrumentTagMarketValueInDealCcyAccruedAmountInDealCcyMarketDataDateExample-36351.8929858342-1222.222222222222024-07-31T17:00:00ZExample42701.67698042281633.067178122842024-07-31T17:00:00Z


Changing below parameters

"pricingParameters": {
        "marketDataDate": "2024-07-31T11:00:00Z",
        "valuationDate": "2024-07-31T11:00:00Z",
        "priceSide": "Mid",
        "useLegsSigning": "True",
        "indexConvexityAdjustmentIntegrationMethod": "RiemannSum",
        "indexConvexityAdjustmentMethod": "BlackScholes",
        "reportCcy": "USD",
        "tenorReferenceDate": "SpotDate"
      }

Response:

InstrumentTagMarketValueInDealCcyAccruedAmountInDealCcyMarketDataDateExample-36351.8929858342-1222.222222222222024-07-31T11:00:00ZExample42701.67698042281633.067178122842024-07-31T11:00:00Z
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Adding screenshots of the response, as the table formatting didn't work.1100-value.png

1700-value.png

1100-value.png (16.6 KiB)
1700-value.png (16.3 KiB)
Hi @Dan.Camp1, I am looking into your request at the moment. It may take some time for me to write the whole request. I am using resources such as this repo and the API Playground, and I will get back to you as soon as I have an update.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.