WebSocket based Financial Markets Data Streaming Platform
Web socket solution 1

Client

A leading technology based broking and wealth management company in India


Problem Statement / Opportunity

There is a growing population of tech-savvy investors who wish to personalise their investment experience based on programmatic access (APIfication) provided by brokerage and exchanges for e.g ‘market data’ such as live quotes, market depth etc and enable users to ‘transact’  at their convenience from an interface of their choice.

Client platform has tens of thousands of active users and it is expected to see a multi-fold jump in near future, and to support this, there is a need to rearchitect the current platform by:

  • Supporting a push mechanism instead of currently followed ‘pull from database’ mechanism for the ‘market data’ refresh. The existing pull mechanism has a lag of several seconds and not scalable
  • Re-architecture for scale by exploring Cloud based infrastructure and relevant native to cloud services for agility, pay as you use, auto scale and on-demand capabilities

Oneture's Role

Oneture designed, developed and load tested the new architecture/platform using WebSocket, AWS Redis, EC2, Application Load Balancer, Node.js, Socket.io library.


Proposed Solution & Architecture

WebSocket APIfication is the core of this solution, we designed an architecture to listen to all the feeds that are received from multiple exchanges on UDP ports. Platform spawns multiple EC2 instances to provide socket connection to the API consumers like mobile apps, and browser based applications. Pushed all feeds to AWS-Redis an in memory caching service to centralise all feeds so connecting sockets gets uninterrupted feeds

Major modules of application.

  • Feed Receiver: This component listens to multiple exchange feeds on different UDP ports, processes row feeds in specific format and add new data points and publish it to Redis.
  • Socket Handler: This component listens https/http request and converts it into WS/WSS protocol, creates room in Redis a hash map of socket id and stock symbols. Whenever new feed gets pushed to Redis distributions, Redis component emits feed to all socket id joined that room.
  • Authentication Middleware: Develop a authentication middleware to authenticate and authorise socket connection. We have developed custom code to do authentication and authorization.

Tools and Technologies Used
Technology Domain Tools
Development Technologies Nodejs, socket.io,Redis
AWS Product & Services
Amazon EC2, Amzon VPC, Amzon S3, Amazon ElastiCache, Redis distribution, Application Load Balancer,  Amazon CloudWatch