Link: https://github.com/Nirmit651/HackRU2026
Inspiration
Every Rutgers student has experienced the uncertainty of campus life. Will the bus actually arrive on time? Is that bus driver taking a break? Will Rutgers win its next game?
We wanted to turn these everyday questions into something interactive. Inspired by prediction markets like Kalshi and Polymarket, we built Scarlet Markets, a play-money prediction exchange centered around Rutgers. Instead of trading on national politics or financial markets, students can trade on events happening right around them.
Our goal was to make prediction markets fun, accessible, and relevant to the Rutgers community.
What it does
Scarlet Markets lets Rutgers students trade on the outcomes of real campus events.
Users receive 1000 play $R and can buy or sell YES and NO contracts on questions involving Rutgers transit and sports. Contract prices change dynamically as users trade, reflecting the market's expectations.
The platform includes:
- Dynamic prediction markets: Buy and sell YES/NO contracts with prices determined by an automated market maker.
- Rutgers bus markets: Follow a specific bus on a live Mapbox map and predict whether it will take a 10-minute break at College Avenue Student Center.
- Rutgers sports markets: Trade on football and basketball outcomes, with automated resolution based on verified game results.
- Live trading experience: View price charts, track holdings and balances, compete on the leaderboard, and review settlement receipts.
When an event concludes, the system determines the outcome using verified evidence and automatically distributes winnings. Correct contracts pay out 1 play $R per share, while incorrect contracts expire worthless.
Everything uses virtual currency, so students can participate without risking real money.
How we built it
We designed Scarlet Markets as a full-stack prediction-market platform, with a focus on accurate pricing, reliable transaction processing, and automated real-world market resolution.
Frontend: We built the interface using React, TypeScript, and Vite, with TradingView Lightweight Charts for visualizing market activity and Mapbox GL for live Rutgers bus tracking.
Backend and database: Our Express and TypeScript backend uses Prisma and Supabase PostgreSQL for market data, wallets, positions, trades, and settlements. Supabase Auth handles authentication, while Supabase Realtime broadcasts market updates to connected users.
LMSR pricing engine: Rather than requiring buyers and sellers to match directly, we implemented the Logarithmic Market Scoring Rule (LMSR), an automated market maker that continuously calculates YES and NO prices based on outstanding contract quantities. Its liquidity parameter controls how strongly individual trades affect prices. Each purchase or sale is priced using the difference in the LMSR cost function, allowing users to trade even without another user taking the opposite side.
Transaction integrity: Trading involves more than updating a number on a screen. Each executed trade atomically updates wallets, positions, market prices, volume, transfer records, and append-only market events. We implemented database row locking, idempotency protections, slippage checks, and safeguards preventing users from holding YES and NO contracts in the same market simultaneously.
Automated market resolution: We integrated Rutgers TripShot GTFS and GTFS-Realtime data to identify approaching buses and monitor their movements around College Avenue Student Center. Our geofencing logic tracks arrival, stationary duration, and departure to determine whether a bus completed a 10-minute break. For Rutgers football and men's basketball, external sports data providers supply game information and verified final results.
A background automation system handles market creation, observation checks, settlement, retries, and replacement markets. If evidence is stale, missing, or inconsistent, the system can pause or void a market rather than incorrectly paying out.
Historical analytics: We use Tiger Data (TimescaleDB) to maintain an asynchronously exported copy of historical market events. This separates transactional operations from time-series analytics and supports efficient aggregation of historical prices, trading volume, and activity.
We also developed simulated trading bots with different participation styles, including casual traders, momentum traders, contrarians, and whales. These bots use the same trading engine as human participants. This lets us demonstrate how trading activity influences LMSR prices in real time.
Challenges
Maintaining financial correctness across concurrent trades was one of our biggest challenges. A single trade affects multiple connected pieces of state, including balances, holdings, contract prices, and the market's audit history. We had to ensure these updates occurred together, even when users submitted requests simultaneously or retried failed requests.
Supporting contract sales added further complexity. Selling requires reversing the LMSR cost calculation, updating outstanding shares, preventing users from selling more than they own, and ensuring that switching between YES and NO positions follows the platform's trading rules.
Turning imperfect live transit data into trustworthy market outcomes was another major challenge. GPS readings can be delayed, missing, or inaccurate, and a bus briefly appearing near a stop doesn't necessarily mean it has taken a break.
We designed a geofence-based state machine to distinguish arrivals, confirmed dwell time, departures, and uncertain observations. We also built protections for stale data, duplicate events, worker interruptions, and market replacement so that unreliable evidence cannot silently produce an incorrect result.
Finally, coordinating live user trades, automated bots, background processing, and real-time frontend updates required us to carefully separate responsibilities across the system.
What we're proud of
We're particularly proud that Scarlet Markets is more than a frontend simulation. Behind each displayed price is a real pricing calculation, transaction, and auditable market event.
Some of our favorite accomplishments include:
- Building our own LMSR market maker that supports both buying and selling contracts with dynamic price movement.
- Developing reliable trading and settlement accounting with transactional integrity and safeguards against duplicate or conflicting operations.
- Turning real Rutgers transit data into prediction markets using geofences, timestamped observations, and evidence-aware resolution.
- Automating Rutgers sports markets through external game data and verified outcomes.
- Creating a live trading experience with interactive charts, portfolio tracking, leaderboards, and settlement receipts.
- Building a bot-driven market demonstration in which distinct trading personalities influence prices through actual transactions rather than artificially changing market values.
Most importantly, we built something specifically for the Rutgers community by combining financial-market mechanics with the everyday unpredictability of campus life.
Built With
- decimal.js
- express.js
- lightweightcharts
- maplibre
- node.js
- postgresql
- prisma
- react
- rest-api
- supabase
- tiger-data
- timescaledb
- typescript
- vite
- vitest
Log in or sign up for Devpost to join the conversation.