Hexagonal Architecture
in Fintech
Presented By: Jasmine Kaur
Software Consultant
Knoldus Software Pte. Ltd.(Singapore)
About Knoldus
Knoldus is a technology consulting firm with focus on modernizing the digital systems
at the pace your business demands.
DevOps
Functional. Reactive. Cloud Native
Agenda
Components of Hexagonal Architecture
Advantages of Hexagonal Architecture
Challenges in Fintech application
Overview of trading life cycle
About Hexagonal Architecture
Agenda
Demo
Overview of sample trading app
How Hexagonal Architecture fix this challenge
About Hexagonal Architecture
The hexagonal architecture, or ports and adapters architecture, is an architectural
pattern used in software design. It aims at creating loosely coupled application
components that can be easily connected to their software environment by means of
ports and adapters. This makes components exchangeable at any level.
Components of Hexagonal Architecture
● Application Core: This is one of the important
component of the architecture which handles the
core business logic of the application.
● Ports and Interfaces: This is the middle layer
component of this architecture which resides
between application core and the adapters
● Adapters: This is the outermost layer of this
architecture. The job of each adapter varies
depending upon their need and utility.
Advantages of Hexagonal Architecture
● All the components under this architecture are
completely independent.
● It is best used in multi-service oriented application
i.e. where any application needs multiple service
components to accommodate their business needs.
● Due its completely independent nature of this
architecture, it is easy to maintain and develop.
Overview of trading life cycle
In the financial market, “trade” means to buy and/or sell securities/financial
products. To explain it further, a trade is the conversion of an order placed on the
exchange which results in pay-in and pay-out of funds and securities. The trade
ends with the settlement of the order placed. All the steps involved in a trade,
from the point of order receipt (where relevant) and trade execution through to
settlement of the trade, are commonly referred to as the ‘trade lifecycle’.
Overview of trading life cycle
Challenges in Fintech application
● The biggest requirement and challenge of a Fintech application is that each of
the components of such a multi-service oriented application should work in
isolation as well as perform in unity with other components to achieve the
required functionality of the application so that the business logic remains
intact even if any of the component goes down.
● Each component of our multi-service oriented application should be flexible
enough to make changes from time to time. For example, if trade reporting
service replace the existing database such as Cassandra with Elasticsearch,
then there should not be any impact on any other component as well as the
entire business logic.
How Hexagonal Architecture fix this challenge ?
1. The first problem was how to make a component truly independent of each
other?
2. The second problem revolves around if we need to make any major
infrastructure change like replacing existing database with another.
Overview of sample trading app
1. Matching Engine - It just accepts the trades from multiple input sources like
REST and FIX and then performs matching based upon the criterias.
2. Trade Booking service - It accepts the Matched trade and transforms it into a
transaction report request and sends to TxReporting service.
3. TxReporting service - Only responsible to report the transactions and persist
into the DB.
Overview of sample trading app
DEMO
FIX Message for NewOrderSingle(MsgType = 35)
Tag Number Field Name Examples(if exists)
11 ClOrdID
54 Side Buy/Sell
44 Price
38 OrderQty
460 Product Commodity, Corporate
167 SecurityType Future, Swaps
FIX Message for Execution Report (MsgType = 8)
Tag Number Field Name Examples(if exists)
37 OrderID
17 ExecID
150 ExecType New, Rejected, Expired
39 OrdStatus Accepted for bidding, Rejected, Expired
54 Side Buy, Sell
151 LeavesQty
14 CumQty
6 AvgPx
References:
● https://en.wikipedia.org/wiki/Hexagonal_architecture_(software)
● https://blog.knoldus.com/introduction-to-the-trade-life-cycle/
● https://blog.knoldus.com/hexagonal-architecture/
Thank You!
jasmine.kaur@knoldus.com
https://www.linkedin.com/in/jasmine-k
aur-033021102/

Hexagonal architecture in Fintech

  • 1.
    Hexagonal Architecture in Fintech PresentedBy: Jasmine Kaur Software Consultant Knoldus Software Pte. Ltd.(Singapore)
  • 2.
    About Knoldus Knoldus isa technology consulting firm with focus on modernizing the digital systems at the pace your business demands. DevOps Functional. Reactive. Cloud Native
  • 3.
    Agenda Components of HexagonalArchitecture Advantages of Hexagonal Architecture Challenges in Fintech application Overview of trading life cycle About Hexagonal Architecture
  • 4.
    Agenda Demo Overview of sampletrading app How Hexagonal Architecture fix this challenge
  • 5.
    About Hexagonal Architecture Thehexagonal architecture, or ports and adapters architecture, is an architectural pattern used in software design. It aims at creating loosely coupled application components that can be easily connected to their software environment by means of ports and adapters. This makes components exchangeable at any level.
  • 6.
    Components of HexagonalArchitecture ● Application Core: This is one of the important component of the architecture which handles the core business logic of the application. ● Ports and Interfaces: This is the middle layer component of this architecture which resides between application core and the adapters ● Adapters: This is the outermost layer of this architecture. The job of each adapter varies depending upon their need and utility.
  • 7.
    Advantages of HexagonalArchitecture ● All the components under this architecture are completely independent. ● It is best used in multi-service oriented application i.e. where any application needs multiple service components to accommodate their business needs. ● Due its completely independent nature of this architecture, it is easy to maintain and develop.
  • 8.
    Overview of tradinglife cycle In the financial market, “trade” means to buy and/or sell securities/financial products. To explain it further, a trade is the conversion of an order placed on the exchange which results in pay-in and pay-out of funds and securities. The trade ends with the settlement of the order placed. All the steps involved in a trade, from the point of order receipt (where relevant) and trade execution through to settlement of the trade, are commonly referred to as the ‘trade lifecycle’.
  • 9.
  • 10.
    Challenges in Fintechapplication ● The biggest requirement and challenge of a Fintech application is that each of the components of such a multi-service oriented application should work in isolation as well as perform in unity with other components to achieve the required functionality of the application so that the business logic remains intact even if any of the component goes down. ● Each component of our multi-service oriented application should be flexible enough to make changes from time to time. For example, if trade reporting service replace the existing database such as Cassandra with Elasticsearch, then there should not be any impact on any other component as well as the entire business logic.
  • 11.
    How Hexagonal Architecturefix this challenge ? 1. The first problem was how to make a component truly independent of each other? 2. The second problem revolves around if we need to make any major infrastructure change like replacing existing database with another.
  • 12.
    Overview of sampletrading app 1. Matching Engine - It just accepts the trades from multiple input sources like REST and FIX and then performs matching based upon the criterias. 2. Trade Booking service - It accepts the Matched trade and transforms it into a transaction report request and sends to TxReporting service. 3. TxReporting service - Only responsible to report the transactions and persist into the DB.
  • 13.
    Overview of sampletrading app
  • 14.
  • 16.
    FIX Message forNewOrderSingle(MsgType = 35) Tag Number Field Name Examples(if exists) 11 ClOrdID 54 Side Buy/Sell 44 Price 38 OrderQty 460 Product Commodity, Corporate 167 SecurityType Future, Swaps
  • 17.
    FIX Message forExecution Report (MsgType = 8) Tag Number Field Name Examples(if exists) 37 OrderID 17 ExecID 150 ExecType New, Rejected, Expired 39 OrdStatus Accepted for bidding, Rejected, Expired 54 Side Buy, Sell 151 LeavesQty 14 CumQty 6 AvgPx
  • 18.
  • 19.