question

Upvotes
Accepted
7 2 4 4

While using HistoricalCriteriaSearch or FuturesAndOptionsSearch API in TRTH

While using HistoricalCriteriaSearch or FuturesAndOptionsSearch API in TRTH, I was wondering if it is possible to specify a regex style identification in the 'Identifier' key,

e.g. If i want the results for HSI*D2.HF and HSI*P2.HF in the same search request, how would I specify it? Example RIC expected in output HSI14600D2.HF


What changes do I need to make to the below code:


https://selectapi.datascope.refinitiv.com/RestApi/v1/Search/HistoricalCriteriaSearch

{"Request":

{"Range":

{"End":"2022-12-10T23:59:59.999",

"Start":"2022-04-01T00:00:00.000"},

"RicPattern":"^HSI[ABCDEFGHIJKLMNOPQRSTUVWXYZ][D2.HF]$",

"ExpiryDate":null,

"OptionMonthCodes":null,

"OptionTypeCodes":null,

"CouponRate":null,

"StrikePrice":null,

"MaturityDate":null,

"BondTypeCodes":null,

"ContributorIds":null,

"CountryCodes":null,

"CurrencyCodes":null,

"ExchangeCodes":null,

"FutureMonthCodes":null,

"InstrumentTypeCodes":null

}}

trth-rest-api
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.

1 Answer

· Write an Answer
Upvotes
Accepted
32.2k 40 11 19

Hello @mohamed.hisham ,

You could specify it with HistoricalCriteriaSearch :

{
                {protocol}}{
                {host}}{
                {api}}Search/HistoricalCriteriaSearch 
{"Request":
{"Range":
{"End":"2022-12-10T23:59:59.999",
"Start":"2022-04-01T00:00:00.000"},
"RicPattern":"^HSI[0-9]{5}[D,P]2.HF$",
"ExpiryDate":null,
"OptionMonthCodes":null,
"OptionTypeCodes":null,
"CouponRate":null,
"StrikePrice":null,
"MaturityDate":null,
"BondTypeCodes":null,
"ContributorIds":null,
"CountryCodes":null,
"CurrencyCodes":null,
"ExchangeCodes":null,
"FutureMonthCodes":null,
"InstrumentTypeCodes":null
}}

If you are looking to use FuturesAndOptionsSearch- it is more aligned with the nature of the instrument- Option.

Letters D and P denote expiration months. I.e. April, May, etc. and you would be looking for a specific range of expiration months. So to look up the expiration date range that you require, rather then a discrete list of months, could be simple:

{
                {protocol}}{
                {host}}{
                {api}}Search/FuturesAndOptionsSearch 

"SearchRequest": {
"FileCodes": null,
"CurrencyCodes": null,
"ExchangeCodes": null,
"AssetStatus": "Active",
"StrikePrice": null,
"ExpirationDate": {
            "@odata.type": "#DataScope.Select.Api.Search.DateRangeComparison",
            "From": "2022-04-01T00:00:00.000Z",
            "To": "2022-06-30T00:00:00.000Z"
        },
"IdentifierType": "RICRoot",
"Identifier": "HSI*",
"FuturesAndOptionsType": "Option
}
}
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.

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.