Skip to main content

CLOB Architecture

Mayybee uses a Central Limit Order Book (CLOB) with price-time priority:
  1. Orders sorted by price (best price first)
  2. Same price → older orders have priority
  3. 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);
};

Price Format

Prices are in cents (0-100):
PriceUSD 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.

Size Format

Sizes are in wei (18 decimals):
WeiTokens
10000000000000000001
1000000000000000000010
100000000000000000000100