Skip to content
Parth Parekh
STAGE 03SERVINGMARKET DATA PLANE
← BACK TO THE MAP

The data API the whole desk reads

A distributor is only half the job — services need candles, history and quotes over an interface, with guarantees. This stage is the equity data service: REST and WebSocket, tiered caching, and a hard rule that a closed candle never changes underneath a consumer.

THE SHAPESERVING
SUBSYSTEMPREFERREDLAST RESORTMarket-data feedExchange binary feedBroker socket, on silence thresho…Last trusted bookRefuse to publishQuote and candle readsLocal cacheRecent-tick storeWarehouseBroker APIOrder statusLive status socketCached snapshotOrder and trade bookDirect status queryClient routingClient directorySame-day routing cacheRefuse — previous-day state is no…Order persistenceLocal write-ahead commitBackground replication to the sto…Reconcile against the broker bookBroker connectivityPrimary hostPer-host circuit opens after repe…Backoff and retryAlert the deskWarehousePrimary nodeReplicaBackup replication of both storesDocumented recovery pathEVERY CHAIN ENDS IN REFUSING RATHER THAN GUESSING. A SYSTEM THAT CARRIES ON WITH INVENTED STATE FAILS SILENTLY, AND SILENT IS THE EXPENSIVE KIND.FIG. L — DEGRADATION LADDER
Every read has an ordered fallback chain, and every chain ends in refusing rather than guessing.
TIERTIME TO BE WHOLE AGAIN1 s1 min1 hr1 dayFAILOVERAutomatic, in-processAvailability — keep trading nowsilence switch · circuit breaker · cached routing · status fallbackREPLICATIONScheduled, one-directionalDurability — the copy existsprimary → backup for both stores · lag measurable on demandRESTOREDeliberate, human-initiatedRecoverability — trade off the copyverify the gap · repoint configuration · restart · reverse when primary returnsA BACKUP THAT EXISTS IS NOT A BACKUP YOU CAN TRADE OFF. THOSE ARE DIFFERENT TIERS, AND ONLY ONE OF THEM IS AUTOMATIC.REPLICATION CADENCE IS THE WORKING RECOVERY-POINT TARGET UNTIL A TIGHTER ONE IS SET AND DRILLED.FIG. M — CONTINUITY TIERS
Failover, replication and restore are three promises on three clocks. Only the first is automatic, and a backup that exists is not a backup you can trade off.
WHAT I BUILTSERVING

Built here.

  • 01

    A FastAPI service with REST and WebSocket surfaces for candles, quotes and instrument reference data across the NSE equity universe.

  • 02

    A candle-immutability guarantee: once an interval closes it is frozen, so two consumers asking the same question an hour apart get the same answer.

  • 03

    A tiered read path — local cache first, then the recent-tick store, then the warehouse, then the broker API — with an explicit fallback order rather than an accidental one.

  • 04

    A pooled broker-account layer so token limits and rate limits are handled centrally instead of being every caller's problem.

  • 05

    Symbol normalization and an instrument manager, because the same stock has a different identifier in every upstream dump.

  • 06

    Containerized deployment with health and cache-retention controls.

WHAT IT SURVIVESFAILURE MODES

Failure modes.

  • An upstream that is rate-limiting or unavailable, which degrades to the next tier instead of erroring the caller.
  • Cold start at the open, when the warmup universe has to be loaded before the first request arrives.
  • Cache growth, which is bounded by retention policy rather than by the disk filling up.

Research, dashboards and the order path all read one interface. When someone asks why a number differs between two screens, the answer is a cache tier, not a mystery.

STACKON THIS STAGE