FIPS
Prediction markets, but with fake internet points
What is this?
The main idea is that instead of an exchange listing things, the users list them.
Not long ago, most of trading happened "bilaterally". Someone at a bank or trading firm called someone else or sent them a term sheet, they agreed, and handed it to their back office to record. That still goes on a lot, but most people now are used to "exchanges" where the term sheet is pre-defined, and people just trade on these pre-defined contracts, because way easier.
We're trying to marry the two. The users still define their own contracts and settle them with each other, but there's this fun piece of code that helps, it does the arithmetic and has bright colors.
You might ask: So the user that created the market settles it, can they settle it "wrong"? Yeah. What do you do about it? You stop trusting them. You can also user the handy disapprove button to make their reputation score go down. Maybe we'll make that more robuster as we see how this plays out. That's also a thing where you can tell FIPS what market creators you trust, also something that could evolve, just not sure how it should evolve yet. Maybe make it opt-in. Anyway the point is to bring peer-to-peer to the exchange world. If you're into shitty catchphrases, it's "uber for markets". For now, just don't think of it as an exchange, think of it as a video game. Please.
Fintech stuff: matching is pro-rata, PandS is FIFO. More about that later.
Market Types
Outcome markets: yes/no stuff, or any discrete outcome thing like who wins your kids baseball tournament.
Futures markets: idk why we call it that, it's really just betting on a number and the more right you are the more money you make. Like buying stock.
Other stuff
- How P&S works This is a finance thing people may not get but should. You can have realized pnl before the thing you're betting on happens.
- Point types Make your own points with its own symbol. Any use of this other than for this website is strictly frowned upon by us. No cash value.
- Create a market You are the lister. Be the lister. Be lazy and just steal from Kalshi or whatever. We will help you steal with the click of a button.
- Under the hood The insides of Frankenstein. This was written almost entirely to play with tech. It is insane by design. Don't judge. Or do.
Stuff we might build
Market deduplication. Right now two people can create the same market and confuse people on purpose or otherwise. idk maybe AI can fix this ;) We think there should be some kind of "merge market" function, there the person that created the less liquid one gives up and novates to the other one. Google novate. idk in our experience consolidation of stuff just seems to happen all by itself. Every reddit post has hundreds of duplicates. One of them wins. Maybe that will work here too.
Purchase & Sale
When you buy something and later sell it (or the other way around), that's a "purchase and sale". Trading people call it "PNS" or "PandS", prononounced either way. It may seem obvious but there's lots of different ways to calculate this. We picked one that makes sense here.
FIPS does FIFO
So yea that's one of the ways, and it's the way here. You get long or short, and then later you go the other way, your profit or loss is with your earliest trade in the other direction. We may not have explained that right, google or something as there are better explanations on the web we're sure.
Why FIFO?
The other big one is "average price". Blah blah blah intra-day pnl vs daily settlements. We don't do daily settlements, because too much work for the market creator, so FIFO all the time it is.
What happens at settlement?
If you still have open lots when a market settles, they get closed at the settlement price. For probability markets that's 100 (winner) or 0 (loser). For futures it's whatever the final value is, subtraction ensues. Maybe if we do 50/50 for ties or something in the future, but not now. Market creators have to add "Tie" or "Other" or "Field" to cover outcomes not listed.
Under the Hood
FIPS uses microservices like it's going out of style. Bird owns the order books, Claire owns the money, Mary talks to both. Other things do other things.
When you place an order, Mary asks Claire to reserve your collateral first. If you can afford it, Mary forwards the order to Bird for matching. Bird returns any trades, Mary sends those back to Claire for clearing, balance updates, position tracking, lot creation. Then Mary broadcasts book updates over WebSocket so everyone's screen updates.
We spose Claire could be between Mary and Bird, probably better if we want external market makers, but we didn't do it that way.
Components
Mary
TypeScript / BunThe exchange. Manages accounts and balances, serves the web UI, handles WebSocket book updates. Orders are forwarded to Bird for matching over TCP. Everything goes through Mary.
Bird
RustThe matching engine. A standalone Rust process that owns all order books. Uses pro-rata maching. We think that suits betting. Not sure why, just sure. Implied markets are built in. That's kind of a key thing, we should probably make it all caps or something but we didn't.
Wayans
TypeScript / BunSnap responder. When you click "Snap" on a market, Wayans fetches external prices, applies an edge to create a bid/ask spread, and places orders atomically. If you think fake internet points matter, hesiste before clicking snap. Yeah we should propbably have a "snap preview" thing.
Sly
ZigThe in-house market maker. A standalone Zig binary that creates markets, fetches external prices (Kalshi, EIA, COMEX, NOAA, agriculture), and continuously places orders on a loop. A reference implementation for building custom market makers.
Claire
JuliaThe clearing engine. Owns all financial state, like balances, positions, lots, P & S records, and transactions. Mary delegates every financial read and write to Claire over TCP with JSON framing.
Goose
GoWatchdog service. Monitors Mary health, validates balances, checks for stale tickers, and measures latency. Runs periodic sweeps on configurable intervals.
Artie
TypeScript / BunIcon service. Picks an emoji for each market and outcome using an LLM, caches the result in its own SQLite DB. Returns SVG images via direct URL, no dependency on Mary or any other service.
Scout
TypeScript / BunExternal market search. Pre-fetches and indexes all open Kalshi events and series metadata on startup, refreshes every some minutes. The front page search box queries Scout for instant external results.
The flow of things
When you snap a market, Mary forwards to Wayans. Wayans fetches the current external price (from Kalshi directly, or from Mary's proxy endpoints for EIA/COMEX/NOAA/agriculture data). It applies an edge to create a spread, then atomically cancels your old orders and places new ones. Yes this is a reference to "Men on Film".
Sly runs continuously as a standalone process on each loop iteration it fetches external prices for all its markets, computes orders with a bid/ask spread, and atomically replaces them via Mary's API. This was originally for the demo, so it's named after the Demolition Man.
Matching engine
The matching engine is a standalone Rust process that communicates with Mary over TCP using SBE (Simple Binary Encoding).
For probability markets, buying "Yes" at 60 is the same as selling "No" at 40. The engine crosses these automatically.