Streaming APIs : Building an Open Finance Story

Himasha Guruge
4 min readJul 1, 2021

Open Finance is bringing out a lot of collaboration opportunities to many financial players ranging from banks, brokers, insurance providers, investors and more. With a high-level goal of providing a better and unique experience to customers, it has opened up ways for partnerships that complement each others business. This write up briefs on one such use-case and how you can practically build it in the real world.

The use-case that we are considering involves a partnership opportunity between banks and mortgage insurance providers. When a customer applies for a mortgage, the lender(bank) would require a minimum down payment equal to 20% of the home’s purchase price. If this condition is not satisfied, the lender finds that certain loan to be more risky and would require the borrower to take a private mortgage insurance (PMI) along with the mortgage. In such a use-case, a bank could partner up with a relevant insurance service provider(s) and provide customized insurance quotes bundled along with the mortgage approval to their customers. This would streamline the entire process of mortgaging and provide a consistent experience to the customer.

Business Architecture: Provide PMI bundled mortgage offers

When implementing above scenario, following facts can be considered.

  1. Filter out the loan requests that apply to take out PMIs : this could be done by calculating the loan requests that has a down payment less than 20%.
  2. Retrieve matching insurance quotes for each applicable loan application : Ideally the insurance provider can open up their services through a standard API where they have shared data to retrieve the credit score of the loan applicant and based on that to provide the applicable insurance rate/quote.

As an example, following is a sample implementation of the above scenario by using WSO2 API Manager and WSO2 Streaming Integrator. This would provide typical bank employees with real-time updated loan approvals with bundled insurance quotes.

Sample Implementation Flow

In order to provide real-time updates a managed Websocket API is created utilizing the Streaming API capability that is available in WSO2 API Manager with it’s support for Async API specification. The implementation flow is explained as below.

  1. All mortgage(loan) requests placed by the bank’s customers are sent to a Kafka topic.
  2. Next ,WSO2 Streaming Integrator would perform the following tasks.

2.1 Read all the loan requests from the Kafka topic and filter the requests which require PMI quotes (filter the loan requests with a down payment less than 20%).

2.2. Push the filtered loan requests to a new Kafka topic.

2.3 Read the stream from the new Kafka topic, and for each of the loan requests invoke the Insurance API (Http backend) to get the specific insurance rate applicable. The insurance service would internally go through the lender’s credit score and determine the insurance rate.

2.4 With the retrieved insurance rates, push new events of the loan request + applicable insurance rate and monthly PMI value to a Websocket server.

2.5. Generate an Async API definition for the Websocket backend.

3. WSO2 API Manager would automatically list the deployed Streaming Integrator application and now you could expose it as a managed Websocket API with rate limiting policies (x number of events per day etc), security and other quality of services.

Although this is a simple depiction of how this scenario can be implemented there are more improvements that can be done/ changes that can be accommodated to suit your requirements. For example,

  1. Although we assume that the initial loan requests are pushed to a Kafka topic, this can be written to a file/ database or any other source as well. Any of these sources can be easily supported through WSO2 Streaming Integrator. For example, if the loan requests are written to a database we can capture all these data records through change data capture (whenever a record is inserted to a database table, trigger SI application).
  2. Current Insurance back end is a direct HTTP service invocation but in the real world, this could also be a managed secured API that is exposed. WSO2 Streaming Integrator has the capability to easily invoke secured (such as tokens etc) HTTPS APIs as well.
  3. In this example, we are only partnering with a single Insurance service provider, whereas a bank may want to provide multiple applicable quotes through multiple Insurance service providers.
  4. Finally, the real-time events received could be visualized in a user portal , send notifications (email/sms etc) to customers with their applicable loan approvals and PMIs can be performed to complete the end-to-end experience.

Finally ,if interested to see this in action you could follow https://github.com/himasha/StreamingAPIDemo and setup this up yourself.

--

--