Mohith Korangi Work with me

All work

Real-time appApr 2026Private repo

TestYourTrade

Paper trading on live Indian market prices.

Learning to trade shouldn't cost real money. TestYourTrade gives you a virtual ₹10,00,000, live NSE prices, market and limit orders, short selling, a portfolio and a leaderboard.

Measured

upstream feed per symbol, shared by every user
1
tables with row-level security
6
symbols a client can watch at once
100

Problem

Live prices have to reach every viewer instantly, and every limit order has to fill the moment the price crosses it, without opening one market-data connection per user.

Architecture

ticks prices last price range query fills Market feed Angel One WebSocket Tick broadcast fan-out service Subscriptions reference counted Socket.io rooms one per symbol Order matcher runs on every tick Trading UI React, live charts Redis order book sorted sets by price Postgres orders, trades
From a market tick to a filled order
  • External
  • Service
  • Worker
  • Interface
  • Storage

One upstream subscription per symbol feeds a broadcast service that pushes ticks into a Socket.io room per symbol. On every tick, the matcher queries the Redis order book for limit orders the new price has crossed and fills them, including partial fills at a weighted average price.

Decisions

  • Redis sorted sets as the order book

    Orders are scored by price in separate buy and sell sets per symbol, so finding every order a tick has crossed is one range query.

  • A shared, reference-counted feed

    The first viewer of a symbol opens its upstream subscription and the last one to leave closes it, which keeps the app inside the market-data provider's limits.

  • Rooms per symbol

    Fan-out cost grows with the viewers of one symbol, not with every connected user. A Redis adapter lets the socket layer scale across servers.

  • Postgres with row-level security

    Orders, trades and balances live in Postgres with per-user policies on all six tables, plus Redis locks around balance changes.

Hard parts

  • Partial fills

    A partly filled order is re-queued with its remaining quantity, and its average price is updated by weight.

  • Upstream drops

    The market-data client reconnects automatically, and the socket layer falls back to in-memory mode when Redis isn't configured.

Quality

  • Playwright specs for limit orders, short positions and live order updates, plus unit tests for balances, portfolio maths and the subscription registry.