Select Page

Intro

9 month ago I posted the vision of GraphQL for Avaloq. There I described how easy it would be to access all Avaloq data – transactional and positional – e.g. bookings, clients, contracts, portfolios, contacts, etc. – whatever is stored in the Avaloq database.

Once you have defined and implemented your backend capabilities – the GraphQL Server – a clients GUI/View can mix and match data es they need it based on the GraphQL servers schema. No changes in the backend are necessary, if the clients needs different data. You get ONE endpoint for all clients: mobile, web, fat, other consumers/services. Clients basically fetch data with ONE roundtrip. Caching, batching and security is already included. Is that too good to be true?

Here I describe a step closer to this vision with a first running system of this kind.

If you’re just getting started with GraphQL, check out the How to GraphQL fullstack tutorial website for a holistic and in-depth learning experience.

In the last couple of weeks I found some time to develop a prototype for this vision.

The result is a proof-of-concept at a clients site – in this case the Bank CIC (Switzerland) AG. I would like to thank the managers and supporters at Bank CIC to let me access their Avaloq Dev DB and develop this prototype off-time.

It was really a quick win to get the whole machinery up and running.

Here I will give some descriptions and show some screenshots of live GraphQL queries using the Avaloq GraphQL Server (GraphiQL client).

What makes GraphQL special?

  1. GraphQL lets you describe data requirements in a well-specified query language based on a schema, which exposes API capabilities.
  2. Separation of concerns, not technologies. In GraphQL, the shape of the result is defined by the client, which is more natural. GraphQL decouples API provider from consumers. In endpoint-based API like REST, the shape of returned data is determined by the server. GraphQL puts data requirements in the client where they belong.
  3. The clients query can be considered as a unit of data fetching. GraphQL knows all of the data requirements up front, enabling new types of server functionality. For example batching and caching underlying API calls within a single query becomes easy with GraphQL.

There is a GraphQL client – called GraphiQL  – automatically available with the Avaloq GraphQL server.

The following screenshots are taken from a live (anonymized) Avaloq instance. So they are no fake or mocked data.

We are going to use this client like so:

– Type in your query on the left side. Optionally use Ctrl-Space for code completion.

– Hit the play-button.

– The GraphQL server returns the result on the right side.

Business Partner

Let’s start very easy: Get me a Business Partner with id 777600, return the id only (which may not make sense – just for the sake of a first demo and simplicity):

Capture_

Lets add names to the result – code completion while you type:

Capture02_

Capture03

The Business Partner with more information like Business Unit (Tenant), internal name, name for sorting, etc.:

Capture04

You recognize that the result has the same structure as your query. The server only returns the data the client has requested.

Classes

What about the properties (key value pairs) of the Business Partner. In Avaloq called classes:

Capture05

Drill down into class names (e.g. property name and value names):

Capture06

Interested only in Property with ID 71 (Avaloq calls this a Classification):

Capture07

BP – Person – Relations

A Business Partner (basically a contract with a bank client) has relations to real persons – here they are:

 

 

Capture08

(in the above example we retrieved PERSON_TYPE_ID and the NAME of the Person object)

Container

A Business Partner has containers , show the id of each:

Capture09

Show more info on each container: Reference Currency ID, Container Type ID and the positions of each Container (its POS_ID for now):

Capture10

Positions

Start from scratch with one of the above Container as root query (and show all positions with information per position like: Amount, Asset ID, Curreny ID):

Capture11

Bookings

Show bookings on positions:

Capture12

Combined Queries

Combined queries: a Business Partner, a Container with its positions, a position with its bookings:

Capture13

Container and a position with amount and all bookings with quantity, date, balance, order behind this booking (DOC_ID):

Capture16

Search Business Partner

List of Business Partners where the name is like “Bank%”:

Capture14_

Orders (DOCs)

Details on a Order (doc):  order type, workflow status, last workflow action, timestamp etc.:

Capture17

 

We can continue on and on…

The Avaloq GraphQL server can retrieve whatever data you need from the Avaloq Database.

Open Banking APIs with GraphQL

GraphQL could be just the right technology for Banks and Third Party Provider to implement Open Banking APIs.