Aakash Devkar
← All projects

Microservices · LLM agent · May 2026 – Jul 2026

ForexEdge

A forex paper-trading platform on 19M real minute bars, with a backtester verified to the cent and a research agent whose numbers are machine-checked.

Repo going public soon
real minute bars
19.2M
real minute bars
trades reproduced in SQL
689 / 689
trades reproduced in SQL
research agent live eval
9 / 10
research agent live eval

01

The problem

Retail trading tools often show numbers nobody can check: simulated prices, backtests you can't audit, and AI answers with made-up figures. ForexEdge only presents numbers it can prove: history validated against FRED, backtests reproduced independently in SQL, and every LLM figure checked by code against real tool results.

02

Architecture: services

  1. 1

    market-service

    Ticks → Kafka → TimescaleDB + Redis latest price

  2. 2

    order-service

    Gates: instrument → market open → spread → SL/TP → margin → risk; events after commit

  3. 3

    domain-service

    Pip value, margin, swaps, session clock, spread monitor, FOMC/ECB calendar

  4. 4

    ws-gateway

    Socket.IO live P&L + BullMQ backtester → MinIO

  5. 5

    ml-service

    Walk-forward LSTM evaluation, read-only API

  6. 6

    research-agent

    LangGraph ↔ Groq gpt-oss-120b, 7 MCP tools, deterministic verifier

Plus auth-service and a Next.js frontend. Nx monorepo; Kafka in KRaft mode.

03

What I built

  • Real Dukascopy minute-level bid/ask history for EUR/USD, GBP/USD, USD/JPY and XAU/USD (2010–2022), with M5 to D1 rollups and validation against FRED.
  • Seven backend services in an Nx monorepo (5 NestJS, 2 Python) plus a Next.js frontend.
  • Paper trading with SL/TP, stop-out, and gates for instrument, market hours, spread, margin and risk limits.
  • Price safety: with no live feed, order entry is disabled; simulated prices appear only when switched on and are labelled SIMULATED.
  • BullMQ backtester (MA crossover, London breakout) reporting USD equity, drawdown and Sharpe, with a SQL verification command.
  • LangGraph research agent over a FastMCP server with 7 read-only tools, a least-privilege database login and per-user scoping.
  • Frontend pages: trading terminal, backtest, economic calendar, model evaluation and research.

04

Hard problems

Stopping the LLM from inventing numbers

Problem
An LLM summarising market data can make numbers up, and they look identical to real ones.
Fix
The agent must finish with a submit_report tool call where every claim cites a tool call. A plain-code verifier checks each number against the real tool result (prices rounded to the pair's decimals, USD exact); one retry, then “could not verify”.
Verified
A 10-question live eval with independently computed answers scored 8/10, 9/10 and 9/10, with no per-question tuning.

Backtester reproduced to the cent

Problem
Floating-point ties fired crossovers one bar early, an end date dropped the last day, and pip-based drawdown showed 93% for gold.
Fix
Exact integer prefix sums, inclusive calendar days, and USD equity marked to market at every bar.
Verified
An independent SQL reproduction from the raw minute table matches every trade and metric: 689 of 689 across EUR/USD, XAU/USD and USD/JPY.

Kafka consumers trusting fields nobody sent

Problem
The spread gate never blocked an order because it read a field the producer never sent, and treated “missing” as “allow”.
Fix
Typed, validating message contracts per topic, a shared market clock, and a spread gate based on each instrument's average spread.
Verified
Tests run on captured real Kafka messages.

05

Results

Data19.2M bars, median 0.4–1.6 pips vs FRED, 7.5× compression
Backtest verification689 / 689 trades match independent SQL
Research agent9/10 live eval, 1.5–6.5K tokens per question
ML51.6–51.8% accuracy, below spread break-even
Tests590 Jest + 198 pytest, 18 Nx projects passing

The LSTM doesn't beat trading costs, and the platform says so instead of hiding it.

06

Stack

NestJSTypeScriptNxKafkaTimescaleDBRedisBullMQSocket.IOMinIONext.jsPythonPyTorchLangGraphMCPGroq