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
Same code, but with
valuation_date="2024-07-31T17:00:00Z"
Answers
-
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.
0 -
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).
0 -
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:00ZChanging 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:00Z0 -
Adding screenshots of the response, as the table formatting didn't work.
0 -
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.0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛