Functions to find Option RICs traded on different exchanges

Author

    Dr. Haykaz Aramyan
    Developer Advocate

Overview

The current article introduces functions to construct option RICs on equities and indices. Section 1 defines supplementary functions further called by the main RIC construction functions. In section 2, I define separate functions per supported stock exchange. Section 3 defines a universal function that takes ISIN, maturity, strike, and option type as an input finds all exchanges where the options on the given asset are traded, constructs RICs for them, validates, and returns the constructed RICs along with the prices.

Additionally, I have conducted the class implementation of the solution, which offers more scaleable usability of the functions. Please check it in the associated GitHub folder.

The current version covers the following exchanges:

  • US OPRA - refer to RULES7, RULES2, RULES3, RULES4 in Workspace, and Guideline for strikes above 10000 in LSEG MyAccount.
  • EUREX - refer to RULES2, RULES3, RULES4 in Workspace, and general option RIC structure in LSEG MyAccount.
  • Osaka Exchange - refer to RULES2, RULES3, RULES4 in Workspace, and RIC structure for Osaka exchange in LSEG MyAccount.
  • Stock Exchange of Hong Kong - refer to RULES2, RULES3, RULES4 in Workspace, and RIC structure for HK exchange in LSEG MyAccount.
  • Hong Kong Future Exchange - refer to RULES2, RULES3, RULES4 in Workspace, and RIC structure for HK exchange in LSEG MyAccount.
  • Intercontinental Exchange (ICE) - refer to RULES2, RULES3, RULES4 in Workspace, and general option RIC structure in LSEG MyAccount.

The syntax for the expired options is universal across exchanges and can be found here.

Install and import packages

To start, we first install and import the necessary packages. We use the Refinitiv Data Libraries to retrieve the data. The code are built using Python 3.9. Other prerequisite packages are installed below:

Section 1: Defining helper functions

Functions in this section are helpers and are further called from the functions in Section 2 and Section 3.

1.1 Function to get exchange codes where the option is traded

This function allows to get the list of exchange codes where an option on the given asset is traded. The function takes asset RIC as an input and returns the list of exchanges. Then function is Section 3 constructs RICs for all supported exchanges in that list. The core of the function is the RD Search function.

['IEU', 'EUX']

1.2 Function to get option Expiration month code

This function takes the expiration date and option type as an input and returns the expiration month code for the option, which is further used to construct RICs

1.3 Function to check for expiry

This function checks if the option is expired or not and adds the expiration numenclature if it is.

'AAPLA212216000.U^A22'

1.4 Function to request prices

This function allows validation of the constructed option RICs by requesting prices. If prices are returned, we can confirm that the RIC(s) is (are) valid, otherwise, we can't confirm the validation.

Section 2: Define functions to get option RICs for each exchange

In this section, I define functions for option RIC construction for different exchanges. Those functions take asset RIC, maturity, strike, and option type as input and return validated rics and the prices. If no price is found for constructed RICs, the functions print out possible RICs.

2.1 Function for OPRA

The below function returns option RICs for OPRA exchange.

'AAPLA212218000.U^A22'

  TRDPRC_1 BID ASK
10/22/2021 0.54 0.51 0.54
10/25/2021 0.5 0.49 0.52
10/26/2021 0.55 0.53 0.55
10/27/2021 0.6 0.59 0.62
10/28/2021 0.82 0.75 0.84

2.2 Function for the Stock Exchange of Hong Kong

The below function returns option RICs for Hong Kong exchange.

'HSI18400C2.HF^C22'

  TRDPRC_1 BID ASK SETTLE
12/29/2021 <NA> <NA> <NA> 4651
12/30/2021 <NA> <NA> <NA> 4732
12/31/2021 <NA> <NA> <NA> 5016
1/3/2022 <NA> <NA> <NA> 4826
1/4/2022 <NA> <NA> <NA> 4862

2.3 Function for the Osaka Stock Exchange

The below function returns option RICs for Osaka exchange.

'7974Y500O2.OS^C22'

  TRDPRC_1 BID ASK SETTLE
12/29/2021 None None None 1609
12/30/2021 None None None 1777
1/4/2022 None None None 1516
1/5/2022 None None None 1647
1/6/2022 None None None 1848

2.4 Function for the EUREX

The below function returns option RICs for EUREX exchange.

'STXE42000O2.EX^C22'

  TRDPRC_1 BID ASK SETTLE
12/29/2021 112.5 110.8 114.4 112.9
12/30/2021 100.7 101.5 104.1 102.5
1/3/2022 91.1 87.3 88.8 88
1/4/2022 72.8 79.7 82.8 81.2
1/5/2022 69.4 68.4 71.5 70.3

2.5 Function for the Intercontinental Exchange

The below function returns option RICs for Intercontinental Exchange exchange.

'LFE7000F2.L'

  TRDPRC_1 BID ASK SETTLE
1/19/2022 <NA> 629.5 654 630.5
1/20/2022 <NA> 611 637.5 619
1/21/2022 <NA> 543 577 564.5
1/24/2022 <NA> 410 470.5 472
1/25/2022 <NA> 492.5 530 515

Section 3: Universal function for all above exchanges

In this section I built a universal function which takes ric, maturity, strike and option type as an input, finds all exchanges where the options on given asset are traded, constructs RICs for them, validates and returns the constructed RICs along with the prices.

Below, I test the fuinction for several exchanges and assets:

Option RIC for IEU exchange is successfully constructed
Option RIC for EUX exchange is successfully constructed

{'SPXb182250000.U^B22': SPXb182250000.U^B22 BID ASK TRDPRC_1 SETTLE
Date
2022-01-21 0.25 0.6 0.5 <NA>
2022-01-24 0.5 0.7 0.65 <NA>
2022-01-25 0.4 0.6 0.53 <NA>
2022-01-26 0.4 0.8 0.75 <NA>
2022-01-27 0.3 0.4 0.4 <NA>
2022-01-28 0.45 0.65 0.6 <NA>
2022-01-31 0.2 0.3 0.25 <NA>
2022-02-01 0.2 0.3 0.23 <NA>
2022-02-02 0.05 0.25 0.25 <NA>
2022-02-03 0.05 0.15 0.15 <NA>
2022-02-04 0.05 0.1 0.1 <NA>
2022-02-07 <NA> 0.1 0.05 <NA>
2022-02-08 <NA> 0.1 0.08 <NA>
2022-02-09 <NA> 0.15 0.08 <NA>
2022-02-10 <NA> 0.05 0.03 <NA>
2022-02-11 <NA> 0.15 <NA> <NA>
2022-02-14 <NA> 0.05 0.05 <NA>
2022-02-15 <NA> 0.05 0.05 <NA>
2022-02-16 <NA> 0.05 0.05 <NA>
2022-02-17 <NA> 0.05 0.05 <NA>}

Conclusion

Current article preseneted functions to find valid RICs for options on stock and indices traded in several exchanges. Additionally, I presented a universal function which finds the exchanges where an option on a given asset is traded, constructs RICs for them, validates and returns the constructed RICs along with the price.

The current version of this article is limited for certain exchanges, includig OPRA, EUREX, ICE, Hong Kong and Osaka, and for options on certain asset types, including indices and stocks. Please let me know which other exchanges and/or options on other asset categories you want me to build functions for. You can contact me directly via h.aramyan@lseg.com or raise your questions/suggestion via Q&A portal of Developer community.

  • Register or Log in to applaud this article
  • Let the author know how much this article helped you
If you require assistance, please contact us here