Shivanshu Pathak / Software Engineer · Trading Systems

I build trading systems where a slow answer and a wrong one cost the same.

I build the parts of a trading stack where correctness and latency both matter: pre-trade risk, order execution, and market-data pipelines that stay ordered, idempotent, and replayable.

Now
Software Engineer II, Kryptos
Before
Founding Engineer, Baskt · derivatives trading platform
Studied
B.Tech CS (Cyber Security), CGPA 9.3 · M.S. AI, ongoing
Based
India · open to relocating
starting matching engine…
Fig. 1 A real price-time-priority matching engine running in your browser against synthetic order flow. Place, cancel, get partially filled, watch your position mark to mid. Prices are simulated.how a real one gets fast ↓
§1

Measurements

Numbers I can reproduce on demand. Apple M1 Pro · macOS · Apple clang 21 · -O2 · threads unpinned. The source for every figure is linked.

baselineoptimised
hover a bar for details
Fig. 2

Order book throughput

Flat price levels, intrusive FIFOs and a pooled order store: 1.9× the throughput of std::map on the same 2M-operation stream, with identical fills.

method & source
Throughput, median of 5 runs
higher is better
Throughput, median of 5 runs
std::map + list7.0 M ops/s
flat + pool13.2 M ops/s
Fig. 3

Queue round-trip latency

An acquire/release SPSC ring buffer loses to a mutex queue on raw throughput, but wins where trading cares: median round trip 3.7× faster, p99 20× faster.

method & source
p50
lower is better
p50
mutex queue458 ns
SPSC ring125 ns
p99
lower is better
p99
mutex queue20,250 ns
SPSC ring1,041 ns
Fig. 4

False sharing

Two threads, two counters. Sharing one 128-byte M1 cache line costs ~1.4× per increment (one run: 6×). Padding to the real line size, not x86’s 64 bytes, removes it.

method & source
Median of 5 runs
lower is better
Median of 5 runs
same cache line3.53 ns / increment
padded to 128 B2.47 ns / increment
Fig. 5

Where these numbers sit on the hardware ladder

Log scale, 1 ns to 1 ms. A whole order-book operation costs less than one trip to DRAM. A contended mutex's tail lands next to an SSD read. That gap is the argument for lock-free hot paths.

reference (approx.) measured by me
1 ns10 ns100 ns1 µs10 µs100 µs1 msL1 hitL2 hitmutex lock/unlock (uncontended)DRAM accesscontext switchSSD random readdatacenter round tripflat order book op (avg)76 nsSPSC round trip p50125 nsstd::map book op (avg)142 nsSPSC round trip p991 µsmutex queue round trip p9920.3 µs
Reference latencies and my measurements
L1 hit1 nsreference
L2 hit4 nsreference
mutex lock/unlock (uncontended)25 nsreference
DRAM access100 nsreference
context switch3 µsreference
SSD random read16 µsreference
datacenter round trip500 µsreference
flat order book op (avg)76 nsmeasured
SPSC round trip p50125 nsmeasured
std::map book op (avg)142 nsmeasured
SPSC round trip p991 µsmeasured
mutex queue round trip p9920.3 µsmeasured
Fig. 6

This page, measured live

Frame-to-frame intervals in the tab you are reading. The median is your display refresh. The amber tail is jitter: GC pauses and main-thread stalls. Scroll hard and watch it grow.

Frame-time probe · your browserwarming up
p50
—
p99
—
max
—
late
—
0 ms
Measured live from requestAnimationFrame. “Late” means frames that took more than 1.5× the median. Scroll fast or switch tabs and watch the tail grow.
§2

Anatomy of a trade

Scroll through the tick-to-trade path: where the microseconds go, and which ones software can win back.

tick-to-trade budget≈ 3.2 µs total
packet inorder out
  1. 1Wire → user space~1–2 µs
  2. 2Decode feed~50–200 ns
  3. 3Update book76 ns avg (measured)
  4. 4Strategy~100–500 ns
  5. 5Pre-trade risk~50–200 ns
  6. 6Encode & send~1 µs

Illustrative orders of magnitude for a software path with kernel bypass, from public talks and vendor figures. The segment is my own measurement.

  1. 01 · ~1–2 µs

    Wire → user space

    A UDP multicast packet lands on the NIC. Kernel bypass (ef_vi, DPDK, Onload) DMAs it straight into a ring the application polls, skipping interrupts, syscalls and the socket layer. On a normal kernel path this one stage costs several microseconds.

  2. 02 · ~50–200 ns

    Decode feed

    Parse a fixed-layout binary message in place: no allocation, no copies, no JSON. Check the sequence number. A gap means a packet was lost and the book is wrong until recovery.

  3. 03 · 76 ns avg (measured)

    Update book

    Apply the add, cancel or execute to the order book. With flat price levels and pooled orders, the touch is one indexed load away. This number is mine: 76 ns per operation on an M1 Pro.

    see the benchmark →
  4. 04 · ~100–500 ns

    Strategy

    Turn the new book state into a decision. The hot path is branch-light and precomputed; anything expensive (fitting, calibration) runs off the critical path and publishes parameters.

  5. 05 · ~50–200 ns

    Pre-trade risk

    Position limits, notional caps, price collars and fat-finger checks, applied on every order before it leaves. I built this layer for a derivatives venue. It has to be fast and it must never be wrong.

  6. 06 · ~1 µs

    Encode & send

    Serialise the order into the exchange’s binary protocol and push it out through the bypass stack. The edges of the system, I/O in and out, dominate the budget, which is why serious shops move them into FPGAs.

§3

Experience

Trading and financial infrastructure first. Earlier roles condensed.

  1. Feb 2024 – Sep 2025
    Remote · Texas, US

    Founding Engineer — Baskt

    First engineer on a derivatives trading platform.

    • –Designed and built the pre-trade risk engine: margin and collateral checks, position limits, and liquidation logic applied before an order is accepted.
    • –Built the order execution and settlement path between off-chain services and on-chain programs, with idempotent retries so an order is never filled twice.
    • –Built the real-time event-streaming layer feeding pricing, positions, and PnL services from on-chain events.
    • –Wrote on-chain programs in Rust (Anchor) that ran on mainnet, where every bug is a financial event.

    Rust · TypeScript · Go · Solana / Anchor · PostgreSQL · Redis

  2. Dec 2023 – Present
    Remote · Gothenburg, Sweden

    Software Engineer II — Kryptos

    Enterprise crypto accounting, tax, and portfolio intelligence for global clients.

    • –High-volume, multi-chain transaction ingestion: ordered, idempotent pipelines that can be replayed after a partial failure.
    • –Deterministic cost-basis and tax computation over inconsistent exchange and on-chain data, producing reproducible, audit-ready numbers.
    • –Event-driven, multi-tenant services and high-throughput APIs with back-pressure handling.
    • –OAuth2 / OIDC identity platform: token lifecycle, session security, and multi-tenant SSO.

    Go · TypeScript · Python · PostgreSQL · Redis · AWS

  3. Jan 2023 – Jun 2026
    Bengaluru, India

    Co-Founder & CTO — Touch Computing Technologies

    TouchOS: a browser-based cloud operating system.

    • –Architected VM orchestration, real-time session services over WebSockets, and multi-tenant SaaS applications.
    • –Owned infrastructure, reliability, and the engineering hiring bar.

    Go · Node.js · Docker · Kubernetes · AWS

  4. Aug 2023 – Jul 2024
    Remote

    Software Engineer — Mantle

    Blockchain infrastructure engineering.

    TypeScript · Solidity

  5. 2022 – 2024
    India · Remote

    Backend & ML internships — Early career

    KliqueStart (Backend Developer), Horse’s Mouth (SDE Intern), Metabees (Technical Lead Intern), Ignitus (ML Intern), Amazon ML Summer School.

§4

The platform

Five C++20 projects, one system: from historical replay to matching. Each ships with tests, benchmarks and a write-up of what failed.

ChronosplannedMercuryplannedAetherbuildingAtomplannedCacheLab — cache, branch & allocation profiling across every stage
  1. 01
    building

    AetherUltra-low-latency matching engine

    A miniature electronic exchange: price-time priority matching across multiple instruments, with a custom order book, a memory pool, and deterministic event replay.

    Limit, market, cancel & modify orders · Price-time priority (FIFO), partial fills · Custom price-level book vs std::map · Memory pool: no heap allocation on the hot path · Deterministic, replayable order processing

    measures: Orders/sec · p50 / p99 / p99.9 latency · allocations per order

  2. 02
    planned

    AtomLock-free concurrency library

    Concurrency primitives built from atomics, not std::mutex: SPSC and MPSC queues, explicit memory ordering, and memory reclamation, stress-tested under ThreadSanitizer.

    SPSC ring buffer & MPSC queue · acquire / release vs seq_cst ordering · Cache-line padding against false sharing · Thread pinning, contention benchmarks

    measures: Throughput & tail latency vs mutex queue, by producer/consumer count

  3. 03
    planned

    MercuryMarket-data feed handler

    Receives a simulated exchange feed over UDP/TCP, parses a binary protocol, and maintains sequence integrity under packet loss, duplicates, reordering, and bursts.

    Binary protocol parsing, zero-copy · Gap / duplicate / out-of-order detection · Snapshot recovery · Fault-injecting exchange publisher

    measures: Messages/sec · parse latency · recovery correctness under burst

  4. 04
    planned

    CacheLabCPU & memory performance research

    Reproducible experiments showing how hardware shapes software: cache hierarchy, line alignment, false sharing, branch prediction, AoS vs SoA, allocators, and SIMD.

    L1 / L2 / L3 latency staircase · False sharing & 64 vs 128-byte lines · AoS vs SoA over millions of orders · Branch prediction & SIMD

    measures: ns/op with hardware counters, compiler flags & machine details

  5. 05
    planned

    ChronosMarket replay & backtesting engine

    A deterministic, event-driven simulator that replays historical ticks and models execution realistically: queue position, slippage, spread, and fees.

    Timestamp-ordered event replay · Fill simulation with partial fills · Slippage & transaction-cost models · Market-making & momentum test strategies

    measures: Replay determinism · events/sec · PnL under cost assumptions

§6

Toolbox & open source

Languages
C++20, Rust, Go, Python, TypeScript, SQL, Bash
Systems & performance
Linux, Memory layout, Cache locality, Multithreading, Atomics / memory model, perf · gdb
Trading domain
Pre-trade risk, Order execution, Order books, Derivatives, Market data, PnL & positions
Distributed systems
Event-driven design, Idempotency, Exactly-once semantics, Back-pressure, Replayable pipelines
Networking
TCP / UDP, Multicast, WebSockets, Binary protocols
Data & infra
PostgreSQL, TimescaleDB, Redis, Kafka, AWS, Docker, Kubernetes, Terraform

§7

Hiring for trading systems or low-latency infrastructure? Let's talk.

I reply within a day (IST).