Deploying Integration Adapter Blades

Integration Adapters are adapters which sit between the Platform (Liberator and Transformer) and your banking system. An Integration Adapter can provide pricing or permissioning information to the platform, or it can implement trading or price alert functionality. Integration Adapter blades are developed using the Caplin Integration Suite (CIS) which incorporates the DataSource API to adapt data coming from all sorts of external systems to messages which can be understood in the Caplin trading platform, and ultimately streamed to client applictaions.

Objectives

In this tutorial you are going to deploy some more blades into the trading platform. You will:

  • Deploy a Pricing and a Trading Integration Adapter blade such that you can request prices from the platform and execute trades;
  • Enable the authorisation module on Liberator and deploy a Permissioning Integration Adapter blade which provides authorisation information for various users of the platform;
  • Upgrade Liberator to a new version using the Deployment Framework;

Running the Mock Server

The role of an Integration Adapter is that of integrating with external systems. The external system which we shall be using for the purpose of this tutorial is a mock pricing and trading server which generates prices for a set of currency pairs and provides trading functionality for spot trades. It produces prices for any pair of the following currencies: EUR, USD, GBP, JPY, DKK, ZAR, CHF and AUD. It also recognises the container request for its "Major" currency pairs: GBPUSD, GBPEUR, GBPJPY, GBPAUD and GBPCHF.

Follow the steps below:

  1. Download the file SimpleFXServer-<version>.jar to a location on your hard drive.
  2. Type the following command in your command line tool to start the server: java –jar SimpleFXServer-<version>.jar
    The following stack trace indicates that the server is running:
    <timestamp> [main] INFO quickfix.SocketAcceptor - SessionTimer started
    <timestamp> [main] INFO quickfix.mina.NetworkingOptions - Socket option: SocketTcpNoDelay=true
    <timestamp> [main] INFO quickfix.mina.NetworkingOptions - Socket option: SocketSynchronousWrites=false
    <timestamp> [main] INFO quickfix.mina.NetworkingOptions - Socket option: SocketSynchronousWriteTimeout=30000
    <timestamp> [main] INFO quickfix.SocketAcceptor - Listening for connections at 0.0.0.0/0.0.0.0:14045
  3. To stop the process, use Ctrl + C.

Deploy the Pricing Integration Adapter

Follow the steps below:

  1. Download the Pricing Adapter blade to the kits directory of your Deployment Framework. 
  2. Deploy the blade: ./dfw deploy.
  3. Run the command ./dfw hosts PricingAdapter localhost. This will append configuration in the hosts.conf file (in the global_config directory) which tells the Deployment Framework that the binaries for this blade can be found, and must be started with the other blades, on localhost.
  4. Start up the Deployment Framework components: ./dfw start. The console should indicate that the Pricing Adapter is starting up: Starting PricingAdapter.
  5. Navigate to the Liberator Explorer which we will use as a client to make subscriptions. (The Liberator Explorer can be opened from your Liberator home page, from the “Diagnostics” menu item at the top of the page.) Use the explorer to subscribe to any subject e.g. “/FX/GBPUSD” (use the “subject” bar at the top and hit enter). You will see the prices displayed as follows:

  6. You can also use Liberator Explorer to subscribe to the "Majors" container with the subject “/CONTAINER/FX/MAJOR”. Note: This time remember to select “Container” instead of “Record” from the drop-down list to the right hand side of the subject’s input field. You should see all the currencies in container appearing, each having their own updating prices:

This Pricing Adapter is connected to Transformer, as is usually the case with Pricing Adapters, but not with Trading or Permissioning Adapters. (This is done so that Transformer modules can be added to intercept the data updates and to alter the data messages in some way before propagating them to the clients.)

This is what happens when you use Liberator Explorer to make a record request:

  1. Upon opening Liberator Explorer, a connection is made to Liberator
  2. When you request the GBPUSD currency pair, a StreamLink request message is sent to Liberator.
  3. Liberator recognises the request. It stores the connected client as a subscriber to this record and creates a DataSource request message which it sends to Transformer. Transformer, in turn, propagates this request message to the Pricing Adapter. (The configuration for the routing of requests whose subject commences with "/FX" and "/CONTAINER/FX" is packaged within the PricingAdapter blade and can be viewed in active_blaces/PricingAdapter/Liberator/etc/rttpd.conf and active_blaces/PricingAdapter/Transformer/etc/transformer.conf.)
  4. The adapter interprets the request message, and requests data for GBPUSD from the mock server. When the mock server responds, the Pricing Adapter creates a new DataSource record message composed of the fields (InstrumentName, BidPrice, BidPriceId, etc.) and the associated values returned by the mock server.
  5. The Pricing Adapter sends this DataSource message to Transformer which propagates it to Liberator. (It is at this stage that Transformer can alter the data in the DataSource message before propagating it to Liberator.)
  6. Liberator changes this to a StreamLink message and sends the response data to the Liberator Expolorer client. (Since Liberator implements the fanout data flow model, this data is also sent to any other client applictaions subscribed to the /FX/GBPUSD record.) Liberator also stores this message as a record object in its cache, so should another client subscribe to /FX/GBPUSD the cached record is immediately sent to the new client.

Configuring Integration Adapters in the CMC

Recreate the CMC configuration file and launch the CMC, as done in the previous tutorial. This will add your new PricingAdapter component to the CMC display, connected to Transformer.

Deploying the Trading Integration Adapter

Download the Trading Adapter deploy it, restart the trading platform and update the CMC display to include the Trading Adapter, using the same set of steps as for the Pricing Adapter.

The Trading Adapter is connected to Liberator as trading messages require no alteration by Transformer. 

Liberator Explorer is a client suited to making data subscriptions, but it does not support trade execution. Therefore we’re going to use a simple trading client page which was developed for this tutorial in order to execute trades.

Follow the steps below:

  1. To make the test client page available, download and extract testpage.zip to the following folder:<DeploymentFramework>\kits\Liberator\Liberator-<version>\htdocs
  2. Restart the Deployment Framework and navigate to the following url in a Chrome browser window: 
    http://localhost:18080/testpage/index.html?host=rttp://localhost&port=18080
  3. Press F12 to bring up Chrome’s console panel where you can observe the log being output by the client.
  4. Click “log in” and “trade” on the test page and you will now see that a trade message has been sent to the adapter in your browser’s console window: 
    Publish to /PRIVATE/TRADE/FX succeeded.
  5. You will also notice from the Trading Adapter’s logs that the adapter receives a message on subject /PRIVATE/TRADE/FX with the folowing fields:

    Message: "User: admin || Client Order ID: ... || Order ID: ... || Trade Status: Filled || Currency Pair: GBP/USD || Order Type: Buy || Amount: ... || Price: ..."
    MsgType: "Confirm"

Deploying the Permissioning Integration Adapter

By default the OpenPermissioning blade is active and allows any requests made by the admin user. If you want to deploy a custom Permissioning Integration Adapter which provides information about an authenticated set of users and their authorised actions, you need to deploy the PermissioningService blade (which is a Liberator module blade). Using this blade means that Liberator will request all permission data from the Permissioning Integration Adapter upon startup and will authorise all requests accordingly.

Follow the steps below:

  1. Use the Deployment Framework to deactivate the OpenPermissioning blade.
  2. Deploy the PermissioningService (module) blade.
  3. Download the Permissioning Integration Adapter, deploy it, and restart the platform.

Observe that the admin user is still able to trade on and request any currency pair. A new user, user1 (password1), is also authenticated when you try to log in. Notice that this user is only able to request and trade on currency pairs with base currency GBP.

Review

You should now be comfortable with deploying blades. Remember that the same procedure is used to deployall blades, be they Liberator, Transformer, an Integration Adapter, module or configuration-only blades.