question

Upvotes
Accepted
22 2 4 7

How best to filter invalid instruments in HistoricalSearch?

I am currently trying to query historical instruments on the Hong Kong exchange. I am using the following query:

Search/HistoricalCriteriaSearch
{
  "Request": {
    "RicPattern": ".HK$",
    "Range": {
      "Start": "2010-11-07T00:00:00.000Z",
      "End": "2010-11-08T00:00:00.000Z"
    }
  }
}
 

This returns to me a bunch of duplicate values for each stock like

'0001.HK',
'0001.HK',
'0001.HK',
'0001os.HK',
'0001os.HK',
'0001stat.HK',
'0001ta.HK'

The duplicates contain no real data, only the first instrument is correct. How best can I filter these invalid results in HistoricalCriteriaSearch?

Thanks

tick-history-rest-apiricshistoricalfilter
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
45.2k 103 44 60

I have used the request posted in the question to verify the data. The result is different.

I couldn't find the below RICs in the returned response.

'0001.HK',
'0001.HK',
'0001.HK',
'0001os.HK',
'0001os.HK',
'0001stat.HK',
'0001ta.HK'

I found 10001.HK, 10001os.HK, and 10001ta.HK and there is no duplicated entry.

{
            "Identifier": "10001.HK",
            "IdentifierType": "Ric",
            "Source": "",
            "Key": "VjF8MHgzMDAwMDAwMDAwMDAwMDAwfDB4MzAwMDAwMDAwMDAwMDAwMHx8fHx8fHwxMDAwMS5IS3w",
            "Description": "Historical Instrument",
            "InstrumentType": "Unknown",
            "Status": "Valid",
            "DomainCode": "6",
            "FirstDate": "2007-12-13T00:00:00.000Z",
            "LastDate": "2011-03-20T00:00:00.000Z",
            "History": []
        },
        {
            "Identifier": "10001os.HK",
            "IdentifierType": "Ric",
            "Source": "",
            "Key": "VjF8MHgzMDAwMDAwMDAwMDAwMDAwfDB4MzAwMDAwMDAwMDAwMDAwMHx8fHx8fHwxMDAwMW9zLkhLfA",
            "Description": "Historical Instrument",
            "InstrumentType": "Unknown",
            "Status": "Valid",
            "DomainCode": "6",
            "FirstDate": "2007-12-13T00:00:00.000Z",
            "LastDate": "2011-03-20T00:00:00.000Z",
            "History": []
        },
        {
            "Identifier": "10001ta.HK",
            "IdentifierType": "Ric",
            "Source": "",
            "Key": "VjF8MHgzMDAwMDAwMDAwMDAwMDAwfDB4MzAwMDAwMDAwMDAwMDAwMHx8fHx8fHwxMDAwMXRhLkhLfA",
            "Description": "Historical Instrument",
            "InstrumentType": "Unknown",
            "Status": "Valid",
            "DomainCode": "6",
            "FirstDate": "2010-09-13T00:00:00.000Z",
            "LastDate": "2011-03-20T00:00:00.000Z",
            "History": []
        },

Could you please share the full response and what do you mean by invalid instruments?

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.

Hi,

I would like to ignore any instruments that are not real equities, ie '0001os.HK', '0001ta.HK'.

I just want to retrieve '0001.HK'. Is this possible?

I found that you have submitted the question to the TRTH V2 support team. Therefore, I have posted the response from the support team for references.

We can use the “Historical Criteria Search” to pull all RICs on a given exchange. In the criteria, we may use the exchange code (e.g. HKG, LSE, etc)

The steps involved are – Go to the Historical Search --> Criteria --> Exchanges --> HKG --> Search.
Upvote
45.2k 103 44 60

You may use HistoricalReferenceExtractionRequest to filter those invalid RICs.

After getting all RICs from the criteria search, you can send those RICs to HistoricalReferenceExtractionRequest. Some content fields in HistoricalReferenceExtractionRequest may be used to filer those invalid RICs.

For example, for '0001os.HK', '0001ta.HK', and '0001.HK', you may use a "Trading Status" or "Asset Category" field.


histocalref.png (17.3 KiB)
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.