How can I run this API endpoint on CodeBook?

How can I run this API endpoint on CodeBook?
I'm trying to run the following function, but the output is the following problem
"error
0 {'id': '62dc1e15-2ef8-4d91-b0bb-83e4739233d2/6...",how could this be converted to get currency forward data?
Full script:
response = ipa.curve.Curves().get_curve(
universe=[ipa.curve.ForwardCurve(
curve_definition=ipa.curve.SwapZcCurveDefinition(
currency="EUR",
index_name="EURIBOR",
discounting_tenor="OIS"),
forward_curve_definitions=[
ipa.curve.ForwardCurveDefinition(
index_tenor="3M",
forward_curve_tag="ForwardTag",
forward_start_date="2024-03-24",
forward_curve_tenors=
["0D",
"1D",
"2D",
"3M",
"6M",
"9M",
"1Y",
"2Y",
"3Y",
"4Y",
"5Y",
"6Y",
"7Y",
"8Y",
"9Y",
"10Y",
"15Y",
"20Y",
"25Y"]
)
]
)
],
outputs=["Constituents"])
response.data.df
Related:
https://api.refinitiv.com/data/quantitative-analytics-curves-and-surfaces/v1/curves/forward-curves
Can we convert this to run on CodeBook? What should be the script? Thank you.
Best Answer
-
I am not sure what ipa.curve.Curves().get_curve method is.
However, the ipa.curve.ForwardCurve code should look like this in CodeBook.
import refinitiv.data as rd
from refinitiv.data.content.ipa.curves import forward_curves
rd.open_session()
response = forward_curves.Definition(
curve_definition=forward_curves.SwapZcCurveDefinition(
currency="EUR",
index_name="EURIBOR",
name="EUR EURIBOR Swap ZC Curve",
discounting_tenor="OIS"),
forward_curve_definitions=[
forward_curves.ForwardCurveDefinition(
index_tenor="3M",
forward_curve_tag="ForwardTag",
forward_start_date="2024-03-31",
forward_curve_tenors=["0D","1D","2D","3M","6M","9M","1Y","2Y","3Y","4Y","5Y","6Y","7Y","8Y","9Y","10Y","15Y","20Y","25Y"]
)
]
).get_data()
response.data.dfThe output is:
0
Answers
-
Hello @kevin.clemente
Thank you for reaching out to us. You can use the Endpoint feature of the Data Library for Python to send the HTTP request to the Delivery Platform API endpoint directly. The Endpoint feature resources are as follows:
If you are on the Codebook, there are the IPA Curve with Endpoint feature available on the __Example__/03. Quantitative Analytics/03.08. Curves folder as follows:
About the code with https://api.refinitiv.com/data/quantitative-analytics-curves-and-surfaces/v1/curves/forward-curves endpoint, the example code can be like this:
response = rd.delivery.endpoint_request.Definition(
method=rd.delivery.endpoint_request.RequestMethod.POST,
url="https://api.refinitiv.com/data/quantitative-analytics-curves-and-surfaces/v1/curves/forward-curves",
body_parameters={
"universe": [
{
"curveDefinition": {
"currency": "EUR",
"indexName": "EURIBOR",
"name": "EUR EURIBOR Swap ZC Curve",
"discountingTenor": "OIS"
},
"forwardCurveDefinitions": [ {
"indexTenor": "3M",
"forwardCurveTag": "ForwardTag",
"forwardStartDate": "2021-02-01",
"forwardCurveTenors": [
"0D","1D","2D","3M","6M","9M","1Y","2Y","3Y","4Y","5Y","6Y","7Y", "8Y","9Y","10Y","15Y", "20Y","25Y"]
}
]
}
]
}
).get_data()
if response.is_success:
print(response.data)
else:
display(response.errors)Result:
0 -
I couldn't find how to set the "outputs" parameter in the forward_curves.Definition.
However, you can set in the request message, as shown below.
response = rd.delivery.endpoint_request.Definition(
method=rd.delivery.endpoint_request.RequestMethod.POST,
url="https://api.refinitiv.com/data/quantitative-analytics-curves-and-surfaces/v1/curves/forward-curves",
body_parameters={
"universe": [
{
"curveDefinition": {
"currency": "EUR",
"indexName": "EURIBOR",
"name": "EUR EURIBOR Swap ZC Curve",
"discountingTenor": "OIS"
},
"forwardCurveDefinitions": [ {
"indexTenor": "3M",
"forwardCurveTag": "ForwardTag",
"forwardStartDate": "2024-03-24",
"forwardCurveTenors": [
"0D","1D","2D","3M","6M","9M","1Y","2Y","3Y","4Y","5Y","6Y","7Y", "8Y","9Y","10Y","15Y", "20Y","25Y"]
}
]
}
],
"outputs":["Constituents"]
}
).get_data()
if response.is_success:
display(response.data.raw)
else:
display(response.errors)0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 249 ETA
- 554 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 643 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 192 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛