https://github.com/MHacks-2026/the-pit
Inspiration
Market manipulation works because most people never see it happen. A price moves. An order disappears. Someone profits from a signal that was never real. We wanted to expose that hidden layer of the market and make surveillance impossible to ignore. THE PIT was built around one question: if someone tries to distort a market in real time, can we catch the behavior fast enough to prove exactly what happened?
What it does
THE PIT is a real-time market manipulation detector with an adversarial market built around it. Humans trade alongside autonomous agents inside a live synthetic exchange while the Market Cop watches the event stream for spoofing. When a trader builds deceptive liquidity and then trades against the pressure they created, the Cop follows the sequence through cancellation and issues an evidence-backed citation. It does not just raise a red flag. It shows the orders that triggered it and the timing that connects them. The result is surveillance you can watch happen rather than trust from a black box.
How we built it
We built the exchange from the ground up so the detector would operate against real market mechanics instead of scripted events. SpacetimeDB is the authoritative backend, where matching and surveillance execute inside the same transactional environment. Our TypeScript engine enforces price-time priority alongside risk checks while keeping positions consistent through partial fills. Autonomous traders continuously create pressure inside the market, including an adaptive AI strategy. Every event is chained with SHA-256 so the record becomes tamper-evident. The live interface runs on Next.js and the Market Cop can announce its findings through ElevenLabs, turning a detection event into something the entire room immediately understands.
Challenges we ran into
The hardest part was earning the right to trust the detector. Catching the spoofer we designed was not enough. We had to prove the exchange stayed correct under pressure and then attack the surveillance logic itself. On 171 held-out market paths derived from real cryptocurrency data, the default spoofer was caught in 171/171 sessions without triggering on the other bots. Then we deliberately changed the attack timing and broke our own detector: waiting four seconds before trading or six seconds before cancelling escaped the current rule every time. We kept that result because a serious surveillance system should expose the edge of its knowledge rather than hide it.
Accomplishments that we're proud of
The strongest result is that THE PIT is no longer a demo of an idea. It is the working system. The phone experience trades against the live exchange. The bots run inside the database. The Market Cop detects spoofing in the transaction path and pushes the evidence to the screen within milliseconds. We reduced median order latency at 50,000 historical orders from 15.3 ms to 1.3 ms, while cutting initial phone market data from roughly 38 MB to 0.3 MB. The project now passes 127 unit and simulation tests plus six live database acceptance tests. What began as a way to visualize manipulation became something much more serious: an environment where market abuse can be challenged under controlled conditions and where every detection has to survive the evidence behind it.
Built With
- elevenlabs
- next.js
- pnpm
- react
- spacetimedb
- typescript
- vitest


Log in or sign up for Devpost to join the conversation.