question

Upvotes
Accepted
262 12 15 18

Java code for Bulk Import of Fixed Income ISINs to get RICs in TRTH v2 REST API

I have a client who wants to retrieve prices for a list of fixed income instruments using ISINs in TRTH v2 API using a REST call in Java.As you may know, ISIN/ CUSIP/ SEDOL mappings for Fixed Income instruments in the TRTH v2 Historical Search is work-in-progress (targeted to be fixed with DSS release 11.2)

Using the TRTH v2 GUI as a work around clients can alternatively import Fixed Income instruments using the DSS work flow as illustrated below:

  • On a spreadsheet (CSV file) enter ISN in first column and ISIN’s in second column, for specific exchange prices enter exchange code in fourth column leaving third column blank.
  • Sample: I took ISIN < GB00B16NNR78> and retrieving LSE prices hence entered source code <L> in fourth column:

Col 1 Col 2 Col 3 Col 4

ISN GB00B16NNR78 L

But client wants an equivalent call to upload the csv using Java. Can you provide a JAVA API code that resembles the GUI workaround as suggested above?

tick-history-rest-apijava
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.

@Beera.Rajesh

This is a good opportunity to suggest to your customer to use the TRDC portal and forum. It is free, he can use a pseudo to avoid sharing his identity, he can find documentation, downloads, tutorials, and post queries on the forum directly. The contents of the forum are kept up to date, and the forum is quite active, so he will usually get quick responses.

@Beera.Rajesh, thank you for your participation in the forum. Is the reply below satisfactory in resolving your query? If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question. Thanks, AHS

Hi @Beera.Rajesh. Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question.

Thanks

AHS

@Beera.Rajesh

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
13.7k 26 8 12

@Beera.Rajesh

There is no API call to upload a CSV instruments file, but using the REST API one can create an instrument list, and append instruments to it, including all 4 parameters you list (Identifier type, Identifier, user defined identifier, source).

The java code to create the body of the request to add a single instrument looks like this:

JSONOrderedObject instListJSONObject = new JSONOrderedObject()
   .put("Identifiers", new JSONArray()
      .put(new JSONObject()
         .put("Identifier", "GB00B16NNR78")
         .put("IdentifierType", "Isin")
         .put("UserDefinedIdentifier", "Test")
         .put("Source",  "L")))
      .put("KeepDuplicates", false);

I attached a Java sample, which is a small modification of an existing one from our sample set. As that set uses some libraries, you might want to download the full set (including the libraries) from the downloads tab, and add the attached sample to it. That will make it easy to run it.

The attached sample contains a method addInstrumentsToList which implements this, for one instrument (the one from your example). To append all instruments from a long list it would be easy to either call this method inside a loop, or make a loop inside the method to add all instruments in one go.dss2instrumentsclientsource.zip


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.