Case study

Sigmant
Quant Research, AI/ML, and Full Stack Engineering
Sigmant is an AI-powered algorithmic and quantitative trading platform with 17 skills and 123 agent tools. A conversational agent researches markets, trains and explains models, replays strategies, and proposes trades. I built the Next.js dashboard and API layer, the Python FastAPI skill services, and an execution path that checks risk limits, stops and targets, and trader confirmation before an order reaches one of 7 connectable brokers.
How it’s built
Sigmant · AI-powered algorithmic and quantitative trading platform with a tool-calling trading agent
Sigmant is an AI-powered algorithmic and quantitative trading platform for retail traders, live at sigmant.app. A conversational trading agent works through 17 skills and 123 typed tools to research markets, train and explain models, replay strategies, and propose trades. I built the Next.js dashboard and API layer, the 17 Python FastAPI skill services behind it, and the execution path: every order that opens risk passes a risk envelope, a stop and target check, and trader confirmation before it reaches one of 7 connectable brokers.
- skill microservices, from research and ML to risk and execution
- 17
- typed agent tools across 21 modules
- 123
- features per bar shared by the ML and deep learning models
- 76
- connectable brokers and exchanges
- 7
- Next.js API route files, plus 145 FastAPI endpoints
- 160
- automated test cases in pytest, Jest, and Go
- 4,500+
- lines of application code in TypeScript and Python
- 232k
- Docker Compose services
- 25
Technology and what it does here
- Next.js 14 (App Router) + TypeScript
- Dashboard (51 pages) and BFF API routes that front the Python services
- Python FastAPI + Pydantic v2
- 17 skill microservices, the asyncio pipeline orchestrator and the scheduler
- Anthropic SDK, Gemini, OpenAI, NVIDIA NIM
- Agent LLM waterfall with tool calling, provider cooldown and fallback
- XGBoost, LightGBM, scikit-learn
- SKILL-05 tabular direction models, Random Forest, ensemble, isotonic calibration and magnitude head
- PyTorch
- SKILL-06 LSTM and 1D-CNN sequence models over 32-bar windows, with optional TimesFM backbone
- SHAP
- TreeExplainer for ML and GradientExplainer for DL per-prediction feature attribution
- hmmlearn
- SKILL-16 regime hidden Markov model among on-the-fly micro-models
- MongoDB + Mongoose
- 23 models for users, trades, broker connections, agent conversations, memory, armed entries, backtests
- Redis (ioredis, redis.asyncio)
- Pub/sub from services to the WebSocket server, training job state, shared caches
- Parquet (pyarrow) + InfluxDB
- On-disk candle store per asset and timeframe; InfluxDB for time-series market data
- Socket.IO
- Authenticated WebSocket server pushing session events and notifications to user-scoped rooms
- Go
- Gateway-go streams Binance and Bybit ticks and publishes them to Redis
- C++ (ctypes bindings)
- Backtest engine core and technical indicator kernels compiled to shared libraries
- CCXT, alpaca-py, oandapyV20, Deriv and cTrader APIs
- SKILL-09 broker adapters for order placement, account state and instrument lists
- NextAuth v5, Zod, TanStack Query, Zustand, Lightweight Charts
- Auth, request validation, client data fetching, state, and candlestick charting
- Docker Compose, GitHub Actions, nginx, systemd
- CI matrix (20 pytest suites, 10 image builds), then VPS deploy with health check and rollback
Implementation details
- The agent's 123 tools are split into read tools that run immediately and write tools that only return a proposal card the trader must confirm; a naming convention (get_/list_/analyze_ vs propose_/set_/place_) is enforced by test, and SKILL-09 (order placement) is marked not directly callable.
- Tools load on demand: each turn starts with a small core set and the agent calls load_more_tools for the rest, using Anthropic defer_loading with tool_reference blocks so the cached prompt prefix is untouched, because sending all definitions cost about 26k tokens per call.
- The LLM layer is a provider waterfall (default order anthropic, gemini, openai, nvidia) that benches a provider for 5 minutes on auth, quota or billing errors and scales thinking effort per task; the Python skills have their own waterfall over OpenAI, Gemini, OpenRouter and NVIDIA.
- ML and DL models share one 76-feature matrix and are labelled with triple-barrier labels and sample-uniqueness weights, evaluated with purged walk-forward folds, and research signals are scored with deflated Sharpe and probability of backtest overfitting.
- Unattended orders must fit a risk envelope (max risk per trade, open risk, daily trade count, daily-loss and drawdown breakers, a ramp period with halved risk) that is checked by the caller and again at the SKILL-09 order boundary; every entry also needs a valid stop loss and take profit before any broker is contacted.
- Strategy code written by the agent runs in a jail with no network, an empty environment, read-only inputs and CPU, memory and process limits using bubblewrap or unshare, and the lab refuses to run if neither isolation tier works.
- Candles moved from MongoDB sessions to an on-disk Parquet store keyed by asset and timeframe with atomic writes and refetch of the still-forming bar, after session candles filled the database.
- The deploy workflow runs after CI passes, builds the web app on the runner, pushes the commit to a bare repo on the VPS, then runs the release with a health check and automatic rollback to the previous commit and bundle.
System architecture
Sigmant runs as a Next.js dashboard and API layer in front of 17 Python FastAPI skill services. Market data feeds a shared feature and model pipeline. A tool-calling trading agent uses those services to research and propose trades, and every order passes risk and protection checks before a broker adapter sends it.
Project screenshots
Open full-size screenshot in a new tabResults and testing
Historical evaluation
The historical study retained 27,622 usable rows after label-quality checks. It evaluated directional models against matched random entries and applied the same simulated costs to both.
A smaller registry response
I grouped registry results in MongoDB by asset, timeframe, model type, and feature hash, then returned the latest ready model in each group without the equity-curve payload. In one measured query, the response fell from 23.6 MB to about 0.4 MB.
Repeatable tests
An isolated run passed 66 Python tests for expected-move estimates, tradeability checks, and overlapping positions. Another 23 web tests passed for proposal claims, simulated fills, and replay.

Full Stack Engineering
The dashboard, API, and broker adapter had to agree on the account, proposal state, and execution outcome even when a request timed out or a user opened more than one tab.
Keep execution tied to the selected account
I enforced the selected broker account across session and execution paths, added per-broker drawdown baselines, and handled ambiguous close responses so the system could reconcile broker state.
Make proposals safe to act on
I added an atomic proposal claim in MongoDB to prevent two requests from claiming the same proposal at once. I also separated approval acknowledgement from broker dispatch so a slow fill could be reflected through status updates.
Make releases traceable
I added a release command for commit-pinned builds, production restart and status tools, and tests for deployment overrides. The web rollout checks the replacement before moving traffic.
AI/ML Engineering
The research question was whether a directional model added value once the same entry rules, fees, and slippage were applied to both the model and its baseline.
Design the evaluation around time
I implemented chronological splits that purge rows whose label horizons cross a split boundary and add an embargo between periods. I tuned labels by asset and compared entries with matched random controls under the same fee and slippage rules.
Estimate move size
Directional predictions failed to beat the matched controls on the evaluated windows. I added XGBoost models that estimate the size of a move and wired those estimates into the agent’s cost check, with a volatility-based fallback when a model estimate is unavailable.
Make model artifacts reviewable
I added artifact validation, registry snapshots, and SHAP summaries. The model management UI gained a record of what was trained and a way to inspect which inputs drove predictions.
Quant Research and Risk
The backtest needed to track when capital was available and how much of a possible move execution costs could consume. Those assumptions change which signals are worth acting on.
Track open positions in the replay
I corrected position accounting for trades that would overlap during their holding window. I also updated the simulator to apply fees and slippage, respect spot-market constraints, and replay position management after entry.
Record why a trade proceeds or stops
I connected the round-trip cost check to the estimated move and added fixtures for proposals, deferrals, and blocks. Historical simulations and the dashboard’s audit trail give me a way to inspect those decisions under the same rules.
Technologies
- Python
- FastAPI
- Next.js
- TypeScript
- XGBoost
- LightGBM
- PyTorch
- scikit-learn
- SHAP
- MongoDB
- Redis
- Parquet
- Socket.IO
- Go
- C++
- Docker
- GitHub Actions
