simple & extensible prediction markets built with rust
- lmsr pricing - polymarket-style logarithmic market scoring rule with unlimited liquidity
- instant trading - buy and sell shares at algorithmically determined fair prices
- oracle resolution - designated resolvers ensure accurate market outcomes
- price charts - real-time probability tracking with historical data
- multi-theme ui - choose from light, dark, hacker, sepia, and pastel themes
- session management - secure cookie-based authentication
- rust - blazing fast & memory safe
- axum - modern web framework
- sqlite - embedded database via sqlx
- askama - type-safe html templates
- chart.js - interactive price charts
- htmx - dynamic ui without heavy javascript
# pull and run the latest image
docker run -d \
-p 3000:3000 \
-v market-data:/app/data \
ghcr.io/ludeed/market:latest
# open browser
open http://localhost:3000# clone the repo
git clone https://github.com/ludeed/market.git
cd market
# build and run with docker
docker build -t market .
docker run -p 3000:3000 -v market-data:/app/data market
# or run directly with cargo
cargo runanyone can create a binary prediction market with:
- a yes/no question
- an end date
- an optional oracle (resolver)
markets use lmsr (logarithmic market scoring rule) for pricing, which provides:
- unlimited liquidity (no liquidity pools to drain)
- fair pricing based on outstanding shares
- smooth price discovery
buy or sell shares at any time:
- see real-time cost preview before trading
- track your positions and p&l
- view historical price charts
when a market ends:
- the designated oracle (or creator) resolves the outcome
- winning shares pay out $1 each
- losing shares are worthless
- profits are automatically credited
market/
├── src/
│ ├── domain/ # core business logic (lmsr, positions, markets)
│ ├── repository/ # database access layer
│ ├── web/ # http handlers, routing, sessions
│ └── db/ # database utilities
├── templates/ # askama html templates
├── static/ # css and client-side assets
└── migrations/ # sql schema
the app uses environment variables:
DATABASE_URL=sqlite:market.db # database path
HOST=0.0.0.0 # bind address
PORT=3000 # port number# run with auto-reload
cargo watch -x run
# run tests
cargo test
# format code
cargo fmt
# lint
cargo clippysee ROADMAP.md for planned features and known issues
MIT