Forkast Knowledge Center
Platform Mechanics
Order Matching Mechanism
4min
Forkast employs a robust order matching system that prioritizes efficiency and fairness in its prediction markets. The matching engine follows specific rules to match buy and sell orders, ensuring seamless trade execution.
- Normal Matching (Priority 1) Matches buy orders (bids) with sell orders (asks) based on the following rules:
- Price Priority: Buy orders with higher bid prices are matched first with sell orders having lower ask prices.
- Refunds: If a buy order's bid price exceeds the matched sell order's ask price, the buyer is refunded the price difference. Example:
- Sellers:
- Seller A: 0.6 Yes (30 shares)
- Seller B: 0.7 Yes (30 shares)
- Buyer:
- Buyer C: 0.8 Yes (30 shares)
- Matching: Buyer C is matched with Seller A at 0.6, and Buyer C receives a refund for the price difference.
- Mint Matching (Priority 2) If no normal match is possible, the system matches two bids from "Yes" and "No" buyers, provided their combined prices equal 1 PC. The system mints Yes-No tokens for both buyers. Example:
- Buyer A: 0.6 Yes (30 shares)
- Buyer B: 0.4 No (30 shares)
- Matching: Tokens are minted as Yes price (0.6) + No price (0.4) = 1 PC.
- Merge Matching (Priority 3) If no normal match is available, the system matches two asks from "Yes" and "No" sellers, provided their combined prices equal 1 PC. Tokens are merged, and sellers are paid in PC. Example:
- Seller A: 0.7 Yes (30 shares)
- Seller B: 0.3 No (30 shares)
- Matching: Orders are merged as Yes price (0.7) + No price (0.3) = 1 PC.
īģŋ
- First-Come, First-Served If multiple orders have the same price, the matching engine prioritizes them based on the time they were submitted.
- Redundant Matching
- Market Orders: Remaining unmatched amounts are canceled and refunded immediately.
- Limit Orders: Remaining unmatched amounts stay on the order book and continue in the order queue until expiration or market closure.
What happens to unfulfilled buy orders when a market resolves? If a market resolves before your buy order is fulfilled, the order is automatically canceled, and your funds are fully refunded.
īģŋ
- Partial Fill
- Seller places a limit order: Sell Yes @ 0.7 (30 shares).
- Buyer places a market order: Buy Yes (20 shares).
- Result: 20 shares are matched at 0.7. The remaining 10 shares stay on the order book.
- Excess Demand
- Seller places a limit order: Sell Yes @ 0.7 (30 shares).
- Buyer places a market order: Buy Yes (50 shares).
- Result: 30 shares are matched at 0.7. The remaining 20 shares are canceled and refunded.
This matching system ensures efficient and fair trade execution while maintaining transparency and encouraging active participation.