Acquire OpenFIGI Data in Three Lines of Code in Groovy

The following SimpleExample Groovy script demonstrates how to call the OpenFIGI web services using the Coherent Data Adapter: OpenFIGI Client Edition.

Other examples can be found in the integration tests for the OpenFIGI Client.

Ignoring the imports in this example we only need three lines of code to be in a position to execute a call to the OpenFIGI web services:

#24: Configures the Spring application context which we use to acquire instances of the OpenFIGI QueryBuilder.

def applicationContext = new AnnotationConfigApplicationContext (“com.coherentlogic.coherent.data.adapter.openfigi.client.core.configuration”)

#26: A reference to the QueryBuilder is acquired.

def queryBuilder = applicationContext.getBean(QueryBuilder.class)

#28: The query is constructed and executed.

def data = queryBuilder
.withExternalApiKey()
.getRequestBody()
.withWertpapier("851399")
.done()
.doGetAsData();

Below is an example of this script being executed in the GroovyConsole with some sample output below.

An example of the SimpleScript for acquiring OpenFIGI data being executed in the Groovy Console.

Leave a Reply

Your email address will not be published. Required fields are marked *