Ariticle

How to Calculate Forward Outright Price with RDP Library for Python

    Pimchaya Wongrukun
    Developer Advocate

This article will demonstrate how to use Refinitiv Data Platform (RDP) library for Python to calculate Forward Outright Price. Forward Outright Price is the predicted metal price based on the current price and forward rate.

Introduction to the RDP Library for Python

Refinitiv Data Platform or RDP is our cloud-enabled, open platform, that brings together all the contents, including the analytics, customer, and third-party data in one service. Getting data is never been this simple. Even that, it would be ideal if a single library could be used to access all the contents in one place as well. That’s why we have created Refinitiv Data Platform Libraries that has been built to simplify the integration into ALL delivery platforms like our new flagship desktop Refinitiv Workspace that beautifully display the data in all aspects, or directly to RDP interface on cloud or even the real-time streaming called Real-Time services. With this RDP Python library, they will provide a consistent API experience. You can just learn once and apply across the wealth of Refinitiv contents.  And Also, Python provides a large standard library including libraries to analyze data, create beautiful visualizations. It is also easy to learn which we will show you what a few lines of code can do. For more details, please refer to Refinitiv Data Platform Libraries - An Introduction

Prerequisite

1. Access Credentials. To be able to access data used to calculate Forward Outright Price, you need to have the access credentials for Platform - Refinitiv Data Platform endpoint. Please refer to Access Credentials Quick Start for process and details on how to obtain the access credentials for this endpoint. Moreover, you need to have the permission to access the following service endpoints which provided info used in Forward Outright Price calculation:

  • data/pricing/<version>/views/chains
  • data/quantitative-analytics-dates-and-calendars/<version>/date-schedule

Please contact the Refinitiv Account team who can help you to grant permission to access the service endpoints above.

2. Python environment and package installer. Anaconda is the easiest way to perform Python data science and machine learning on Linux, Windows, and Mac OS X. It consists of Jupyter Notebook and the packages that we will require e.g. numpy, pandas. You can download and install Anaconda from here.

3. RDP Library for Python. To install the library:

  • Open Anaconda Prompt:
  • Run the following command:

Forward Outright Price Calculation

To calculate Forward Outright Price, you need to know:

  • The metal RIC
  • The forward offer rate RIC of the metal RIC

You can reach out to LSEG Support who can provide you with the proper RICs. Then, you can retrieve/calculate the following data which is required to calculate Forward Outright Price:

1. Spot Price is snapshot real-time price fields i.e. Bid and Ask of a metal RIC.

We will use RDP library for python to get the snapshot real-time Bid and Ask of a metal RIC using the get_rt function below: 

2. Forward Rate is calculated based on snapshot real-time GV4_TEXT and PRIMACT_1 field of underlying RICs of forward offer rate RIC. The underlying RICs can be retrieved from data/pricing/beta3/views/chains service endpoint using RDP library by sending a REST request to the service endpoint like the rdp_url_request function below:  

The example output:

GV4_TEXT field is TENOR which refers to the length of time remaining before a financial contract expires[1]. PRIMACT_1 field is the lending rate. We will use the get_rt function above to get real-time snapshot of both fields.

Next, we will find out the periods, start and end transaction dates, according to TENOR and Transaction date which is a date upon which a trade takes place for security or other financial instruments [2]. We will send a REST request to data/quantitative-analytics-dates-and-calendars/<version>/date-schedule service API endpoint using rdp_url_request function above.  For more details of this service API endpoint, please refer to Quantitative Analytics - Dates and Calendars in API Playground. Then, we will calculate Forward Rate of each period. 

The source code  according to the explanation above is below:

The example output:

3. Forward Swap Point is calculated from the formula below:

Forward Swap Point  = (Spot Price * (Forward Rate * days)) / Yearly basis

4. Forward Swap Price is calculated from Forward Swap Point according to the formula below:

Forward Swap Price = Forward Swap Point / 100

The source code below shows how to calculate Forward Swap Point and Forward Swap Price:

The example output:

Next, we can calculate Forward Outright Price using the following formula:

Forward Outright Price = Spot Price + Forward Swap Price

Special case on Overnight (ON) and Tomorrow Next (TN) Forward Outright Price, switch Bid/Ask and change sign of Forward Swap Price:

  • ON Forward Outright Bid Price = Bid Spot Price -TN Forward Ask Swap Price - ON Forward Ask Swap Price)
  • ON Forward Outright Ask Price = Ask Spot Price -TN Forward Bid Swap Price - ON Forward Bid Swap Price)
  • TN Forward Outright Bid Price = Bid Spot Price -TN Forward Ask Swap Price
  • TN Forward Outright Ask Price = Ask Spot Price -TN Forward Bid Swap Price

The source code below shows how to calculate Forward Outright Price:

The example output:

For the complete source code, please refer to Article.RDPLibrary.Python.ForwardOutrightPrice.

Summary

In this article, we have demonstrated how to calculate Forward Outright Price which its input can be retrieved using RDP library for python. The article also shows how to use Cufflinks which makes financial data visualization convenient. The RDP library can be used to retrieve data for calculation of any other models to serve more accurate or specific use cases.

References

  1. "What Is Tenor?", in Tenor. Retrieved Jul 3, 2020 from https://www.investopedia.com/terms/t/tenor.asp
  2. "What Is a Transaction Date?", in Transaction Date. Retrieved Jul 3, 2020, from https://www.investopedia.com/terms/t/transaction-date.asp
  3. Refinitiv Data Platform Libraries, Developer Community, Refinitiv Data Platform Libraries | Developer Community
  4. Quantitative Analytics - Dates and Calendars in API Playground, https://apidocs.refinitiv.com/Apps/ApiDocs#/details/L2RhdGEvcXVhbnRpdGF0aXZlLWFuYWx5dGljcy1kYXRlcy1hbmQtY2FsZW5kYXJzL2JldGEx/L2RhdGUtc2NoZWR1bGU=/POST/SWAGGER