Merce Select

PRisM for the NSE
  • Summary

    Industry Capital markets/ stock exchange

    Client The NSE: one of the world's top five trading exchanges by number of trades

    Requirement They wanted to improve the operational efficiency of the trading eco-system while maintaining tight control over risk exposure. To achieve this, they needed to maximise the utilisation of the margin money deposits taken from trading members, and this could be done by implementing sophisticated Value-at-Risk based risk re-calculations for buyer and seller for each trade in real time. If a trading member's risk exposure after a trade exceeded his limits determined by his margin money, the risk engine would inform the order-matching engine before a subsequent trade could be executed for that trading member.

  • Our solution

    PRISM We built an inexpensive cluster of Linux computers which delivered super-computer-like performance to execute the VaR algorithm in real time. This system was called PRISM, for Parallel Risk Machine.

    Business benefits The key challenge of running an efficient exchange is to maximise how much trading a trader or investor can do with a certain amount of capital, i.e. maximising his ability to trade while limiting his risk exposure. The key challenge of running a safe trading market is to minimise risk exposure. These conflicting objectives can be addressed better if a finely tuned real-time risk analysis algorithm is applied to each trader and investor after each trade, re-calculating his risk exposure and deciding in real time whether he's crossed his risk limits. This real-time fine-tuned risk analysis helps traders and investors do more trading with the same capital, thus making the market more efficient without increasing risk.

    Joint project The system was designed and built by a consortium of a few teams. Our team worked on the overall system architecture, the cluster computing layer, the MPI-based communication layer, and the fault tolerance mechanisms. Most of the central cluster's code and the communication layer of the compute nodes was built by our team. The responsibility of technology choice for the low-latency communication network (we evaluated PVM, MPI and a few others) was with our team. A team from IGIDR headed by Profs Ajay Shah and Susan Thomas designed, built and debugged the VaR recalculation code which ran on the compute nodes. A team from Infotech Financials built the UI code for the administrative console in the central cluster, and implemented a few other modules in the central cluster. A consultant, Avadhoot Deshpande, worked with us to sort out technology issues with the bi-directional real-time data feed between NSE's trading systems and PRISM. He was also responsible for many aspects of the business logic and risk evaluation algorithms, client interaction, and interfacing with other legacy systems and processes.

    Design The PRISM system has a pool of Linux compute nodes connected to a central cluster. Each compute node receives jobs from the central cluster, computes results, and sends results back to the cluster. The central cluster controls all the compute nodes and assigns jobs to them. It also tracks non-responsive compute nodes and reassigns stuck jobs to other compute nodes in case a node fails before it completes its job. The central cluster also communicates with the trading system and receives a real-time feed of all trades. It communicates risk positions back to the trading system when a trader or investor has exceeded his risk margins as per VaR. The trading system then suspends further trades on that account.

    Technology All computers run Unix or Linux. The compute nodes all run on Intel x86 hardware. The central cluster and the compute nodes communicate with each other over MPI (Message Passing Interface) over 100~Mbits/sec Ethernet. The communication layer and the VaR calculation code are written in C for maximum performance. The core code in the central cluster is written in C too. The central cluster has a UI application which allows operators to monitor health, see logs of recent activity, and suspend/reenable a trader or investor. This UI application has been written in Java and communicates with the core of the central system over TCP/IP.