Skip to content
Selected project

Case study · Prediction markets

PollBull

A prediction market where prices come from real orders.

Category
Trading platform
Industry
Prediction markets
Platforms
Admin portal · Trading API for web and mobile front-ends
Technology
ASP.NET Core · Blazor · MySQL · M-Pesa

01 · Project overview

What was built, and for whom.

PollBull is a prediction-market platform CodeWave built for a client. Traders buy and sell Yes and No shares on questions such as whether an event will happen by a set date, and the price of a share reflects what the market thinks the chance is. Administrators create and run markets from a Blazor portal; traders reach the platform through a secured API designed for separate web and mobile front-ends. Wallets are held in Kenyan shillings, with deposits and withdrawals through M-Pesa.

Built for
A client building a KES-denominated prediction market with M-Pesa wallets
Type
Selected project
Platforms
Admin portal, Trading API for web and mobile front-ends
Focus
payments web

02 · Business challenge

The problem, as the business experienced it.

A prediction market only works if prices reflect what traders are actually willing to pay, money is held correctly while orders wait, and every market can be closed, resolved and paid out without loose ends.

Trading on outcomes looks simple from the outside: pick Yes or No and set a price. Underneath, the platform has to keep an order book honest, protect funds while orders are open, and close every market cleanly when the answer is known.

  • Prices must come from real buy and sell orders, matched fairly
  • Funds behind an open order must be reserved so they cannot be spent twice
  • New markets need enough liquidity to trade from the first minute
  • Resolution must cancel open orders, release funds and pay winning shares
  • Deposits and withdrawals complete asynchronously through M-Pesa callbacks

03 · Our approach

How we got from the problem to the system.

CodeWave built an ASP.NET Core platform with a limit order book, price-time matching, seeded liquidity, a market lifecycle with evidence-based resolution, and wallets funded and paid out through M-Pesa.

  1. 01

    Model the market

    Binary and multiple-choice markets, with each outcome carrying its own Yes and No book, categories, question templates and linked entities such as people, companies or events.

  2. 02

    Build the trading core

    A limit order book with price-time priority, limit and market orders, time-in-force options and trade estimates that show average price, slippage and fees before an order is placed.

  3. 03

    Manage the lifecycle

    A validated status flow from draft to active, paused, closed and resolved, with resolution evidence recorded and winning shares paid out to wallets.

  4. 04

    Connect the money

    Wallets with a running ledger, M-Pesa STK Push deposits and B2C withdrawals, and reversal of a withdrawal when the payout fails.

04 · Solution architecture

Layers of the system.

Clients at the top, the core application in the middle, integrations and data underneath. Green marks the integration layer where the system meets the outside world.

05 · Key features

What the system does.

Order-book trading

Limit and market orders matched by best price, then time, with GTC, IOC, FOK and GTD options.

Trade estimates

Average price, slippage, price impact and fees calculated from the live book before an order is sent.

Seeded liquidity

A system market maker places light, balanced or heavy order ladders when a market opens.

Market lifecycle

Draft, active, paused, closed, resolved and disputed states, with admin actions for each step.

M-Pesa wallets

STK Push deposits, B2C withdrawals and a ledger entry with the balance after every movement.

Admin portal

Markets, categories, traders, deposits, withdrawals and payment gateway settings in one place.

06 · Technology

The stack behind it.

Chosen for the job — mature, supportable and straightforward to host and staff for in Kenya.

Backend
C# ASP.NET Core 8 REST APIs
Admin portal
Blazor Server
Data
MySQL Entity Framework Core
Security
ASP.NET Identity JWT Role-based access
Integrations
M-Pesa Daraja STK Push B2C

07 · Business impact

What changed for the business.

Outcomes are described qualitatively. Figures are published only when verified by the client and approved for release.

  1. 01

    Share prices are set by matched orders rather than fixed odds

  2. 02

    Funds behind open orders are reserved and released through the wallet ledger

  3. 03

    Markets move through defined states, from draft to resolution

  4. 04

    Deposits and withdrawals run through M-Pesa with the wallet updated from callbacks

08 · Screens

Interface illustration.

A representative illustration of the interface, not a live screenshot — no client data is shown.

Similar problem?

Have a process that looks like this one?

Tell us how it runs today. We will tell you what a system built for your operation would involve.