Full-stack build
ApexTrader
A trading terminal you can talk to: voice orders, live market data, chart-pattern vision and a hybrid ledger that reconciles off-chain trades with Sepolia.
- Order intent extracted from speech by Deepgram plus Groq
- Voice
- Alpaca market ticks streamed over WebSockets
- Realtime
- On-chain transfers indexed alongside off-chain trades
- Sepolia
The problem
A trading terminal is a latency and trust problem in a familiar shape: the price you see, the order you place and the record of the fill have to agree. Adding a voice interface makes the failure modes worse, because a misheard ticker becomes a real order. Adding a wallet makes them worse again, because now there are two ledgers and no reason to believe they match.
ApexTrader was a deliberate attempt to put all of those surfaces in one application: keyboard and voice order entry, streamed quotes, on-chain settlement, a Telegram thin client, and one activity history that reconciles the off-chain and on-chain records instead of showing them side by side.
Approach
- Next.js 14 terminal. App Router shell with a dense, keyboard-first surface: watchlist, order entry, positions, and a Zustand store that broadcasts market state across tabs.
- Voice-to-trade. Audio streams to Deepgram Nova-2 for sub-second transcription; Groq-hosted Llama-3 turns the transcript into strict JSON (
action,symbol,shares,orderType). Telegram audio notes take the same path and come back with an inline confirmation keyboard before anything executes. - Computer vision on charts. A separate engine (
cv_apex_trader) takes raw candlestick images, identifies support and resistance, breakouts, double bottoms and engulfing candles, and proposes entry, target and stop levels rather than a text description. - Zero-friction Telegram linking. A one-click deep link (
/start <token>) bindstelegramChatIdto the account, replacing webhook registration and API-key entry for a mobile client. - Hybrid activity ledger.
UnifiedTradeHistorynormalises paper and market trades with Sepolia transfers indexed through the Etherscan V2 API (chain id11155111) for every registered wallet, in one chronological list. - Streaming analytics. Equity, unrealised PnL, cost basis and a high-water-mark profit tracker recompute per tick instead of on refresh.
- Context-aware copilot. Multi-leg prompts ("liquidate SOL, reserve one Bitcoin of cash, allocate the rest to ETH") resolve into Prisma transactions so the rebalance is atomic.
- 01Terminal, Telegram or microphone input
- 02Deepgram STT → Groq strict JSON intent
- 03Confirmation before execution
- 04Alpaca WebSocket ticks and Prisma order writes
- 05Etherscan V2 indexing of Sepolia transfers
- 06Unified ledger and live performance metrics
Results
| Area | What it does | Note |
|---|---|---|
| Order entry | Voice, Telegram or keyboard | Intent confirmed before execution |
| Market data | WebSocket stream | Quotes push; no polling |
| Chart analysis | Pixel-based pattern detection | Separate CV repository |
| Wallet linking | RainbowKit / Wagmi | Multi-wallet, one account |
| Settlement | Sepolia testnet | Etherscan V2 indexing |
| Ledger | Hybrid | Off-chain trades reconciled with on-chain receipts |
No performance figures are invented for this project. The live deployment is the evidence: Sepolia testnet transactions indexed through Etherscan V2, written to a real Postgres schema alongside the off-chain trades.
What I took from it
Voice is a good demo and a demanding interface. The interesting engineering is not the transcription; it is the confirmation step between a parsed intent and an executed order, and the reconciliation job that has to decide what happens when a chain transaction lands late, lands twice, or never lands at all.
The second lesson is about state. Once quotes stream, a wallet is connected and Telegram writes to the same tables, the ledger stops being a table and becomes a consistency problem. Prisma transactions are what made multi-leg rebalancing safe to attempt at all.