question

Upvotes
Accepted
7 3 2 3

How do I set up call/put in parameter for IPA FX Volatility surface API ?

A way to set up Call/Put in parameter for IPA FX Volatility surface API is not mentioned in the document"IPA Volatility Surfaces : FX".

In Eikon FXVE, call delta and put delta are automatically come up in the bottom section by selecting "delta" as Y axis on the top left of the app:

無題2.png

(Y axis=delta)

無題.png

(Call delta/Put delta)

However, there seems no such a parameter in IPA:

Document: https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis/documentation#ipa-volatility-surfaces-fx


Here is the sample code:

fx_request_body={

"universe": [

{

"underlyingType": "Fx",

"surfaceTag": "FxVol-USDJPY

",

"underlyingDefinition": {

"fxCrossCode": "USDJPY"

},

"surfaceLayout": {

"format": "Matrix",

"yValues": [ "-0.1","-0.15","-0.2","-0.25","-0.3","-0.35","-0.4","-0.45","0.5","0.45","0.4","0.35","0.3","0.25","0.2","0.15","0.1"]

},

"surfaceParameters": {

"xAxis": "Date",

"yAxis": "Delta",

"calculationDate": "2021-09-08T00:00:00Z",

"returnAtm": "False",

}

}

]

}


fx_response = vs_endpoint.send_request(

method = rdp.Endpoint.RequestMethod.POST,

body_parameters = fx_request_body

)


print(json.dumps(fx_response.data.raw, indent=2))


Could you please advise how to set up call/put in API FX Volatility surface IPA on RDP?





rdp-apirefinitiv-data-platformrefinitiv-data-platform-librariesforexipavolatility
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
Accepted
111 1 0 1

Hi @mami.kimura ,


1) This Jupyter notebook is just an example and expected to work properly only with the pre-defined requests there. When some x/yAxis type is changed from the "Date" to "Tenor", it changes output format significantly (Dates vs Strings/Float numbers), what results in the provided error.

If you plan to change or add your own requests in the provided example, you may also need to update existing Python code accordingly or create a separate script/notebook for this purpose.


2) There are additional parameters that can be specified in the API request under "surfaceParameters" section:

            "surfaceParameters": {
                "volatilityModel": "SVI",
                "priceSide":"Mid",
                "deltaConvention": "Spot",
                ....
            }

- When I set these parameters to the same values as selected in FXVE (usually they are the same as provided above) and when I change Delta Convention from "Regular" to "Prem-Adj" in FXVE for USDJPY, I get the same values as in API response.

- API doesn't provide an ability to select Regular or Prem-Adj yet.

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.

Thank you very much!
Upvotes
111 1 0 1

Hi @mami.kimura ,

Thanks for your question. You can use below request to get Call/Put Delta values in the output similarly to what's displayed in Eikon FXVE.

- "Date" axis has been replaced with "Tenor" value.

- "returnAtm": true has been added to the request to display "ATM" values.

- xAxis and yAxis can be swapped with each other to get output in different formats if necessary.

- Delta values below 0 in the input return Put Delta values in the output. Delta values above 0 in the input return Call Delta values in the output.


Let me know if you have any other questions.


Request:

{
    "universe": [
        {
            "underlyingType": "Fx",
            "surfaceTag": "FxVol",
            "underlyingDefinition": {
                "fxCrossCode": "USDJPY"
            },
            "surfaceLayout": {
                "format": "Matrix",
                "xValues": [
                    
                    "-0.1",
                    "-0.15",
                    "-0.2",
                    "-0.25",
                    "-0.3",
                    "-0.35",
                    "-0.4",
                    "-0.45",
                    "0.45",
                    "0.4",
                    "0.35",
                    "0.3",
                    "0.25",
                    "0.2",
                    "0.15",
                    "0.1"
                ]
            },
            "surfaceParameters": {
                "xAxis": "Delta",
                "yAxis": "Tenor",
                "calculationDate": "2021-09-08T00:00:00Z",
                "returnAtm": true
            }
        }
    ]
}
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.

Thank you for the quick response! The code you sent returns value fine but I have a few more questions.


1) I am referring to FX Volatility surface part of this sample on Github:

https://github.com/Refinitiv-API-Samples/Article.RDPLibrary.Python.VolatilitySurfaces_Curves/blob/master/Vol%20Surfaces%20Webinar.ipynb

It consist of 2 requests and first one worked fine with your suggested code, however second one which is to request matrix by using plot returns error message such as "IndexError: index out of bounds".


(First request)

Your suggested code

+

fx_response = vs_endpoint.send_request(

method = rdp.Endpoint.RequestMethod.POST,

body_parameters = fx_request_body

)


print(json.dumps(fx_response.data.raw, indent=2))


(Second request)

2.jpg


(error)

1631101008326.png

1631101030342.png


Could you please advise what to adjust in the code?


2) The returned value gradually gets differ from the FXVE as maturity term gets longer though value of ON and SW seems almost same.

Is there any way to adjust some of the parameter additionally to make it look same?


I would appreciate your advice.

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.