CLOB Architecture
Mayybee uses a Central Limit Order Book (CLOB) with price-time priority:
- Orders sorted by price (best price first)
- Same price → older orders have priority
- Matching happens instantly when buy/sell overlap
Get Orderbook Data
curl "https://api-testnet.mayybee.com/api/markets/{marketId}/orderbook?tokenId={tokenId}"
{
"bids": [
{ "price": 45, "size": "100000000000000000000" },
{ "price": 40, "size": "50000000000000000000" }
],
"asks": [
{ "price": 55, "size": "75000000000000000000" },
{ "price": 60, "size": "200000000000000000000" }
]
}
WebSocket Updates
Subscribe to real-time orderbook updates:
const ws = new WebSocket('wss://api-testnet.mayybee.com');
// Subscribe
ws.send(JSON.stringify({
type: 'subscribe',
channel: 'orderbook',
marketId: 'your-market-id'
}));
// Receive updates
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('Orderbook update:', data);
};
Prices are in cents (0-100):
| Price | USD Value |
|---|
| 50 | $0.50 |
| 75 | $0.75 |
| 25 | $0.25 |
YES price + NO price ≈ 100 cents. If YES is at 60, NO should be around 40.
Sizes are in wei (18 decimals):
| Wei | Tokens |
|---|
| 1000000000000000000 | 1 |
| 10000000000000000000 | 10 |
| 100000000000000000000 | 100 |