Skip to main content

Forsyt Orderbook Integration Guide

This guide covers how to integrate with the Forsyt Universal Orderbook from your TypeScript backend.

Note: For the complete documentation, see the full Integration Guide on GitHub.

Quick Start

Starting the gRPC Server

cargo run --bin server
# Server starts on [::1]:50051

Minimal TypeScript Example

import * as grpc from '@grpc/grpc-js';
import * as protoLoader from '@grpc/proto-loader';

const packageDefinition = protoLoader.loadSync('proto/orderbook.proto');
const proto = grpc.loadPackageDefinition(packageDefinition) as any;

const client = new proto.orderbook.v1.OrderBookService(
'localhost:50051',
grpc.credentials.createInsecure()
);

// 1. Create a market
client.CreateMarket({
market_id: 'match_123',
outcomes: ['Home', 'Away']
}, callback);

// 2. Open the market
client.OpenMarket({ market_id: 'match_123' }, callback);

// 3. Submit a BACK order at 2.50 decimal odds
client.SubmitOrder({
market_id: 'match_123',
outcome_id: 'Home',
side: 'BACK',
price: 2.50,
price_type: 1, // DECIMAL_ODDS
quantity: 100,
order_type: 'LIMIT'
}, (err, response) => {
console.log('Order ID:', response.order_id);
});

Core Concepts: BACK vs LAY

In a betting exchange, every bet has two sides:

SideDescriptionWhat You Are Saying
BACKBetting FOR an outcome"I think Team A will win"
LAYBetting AGAINST an outcome"I think Team A will NOT win"

Topics Covered in Full Guide

  • Decimal Odds conversion
  • Market Types (including Asian Handicaps)
  • Synthetic Matching
  • Order Types: LIMIT and MARKET
  • TypeScript gRPC Integration
  • Event Streaming
  • Best Practices
  • Resetting the Orderbook

Last updated: 2025-12-28

For the complete documentation, visit the GitHub repository.