question

Upvotes
Accepted
262 8 9 15

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 5.0 MiB each and 10.0 MiB total.

1 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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea