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
- 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 中文论坛