Examples
The SDK release includes a set of 10 runnable .NET examples designed to help you get started quickly with the Unified Odds Feed SDK. These examples demonstrate common integration scenarios and provide a hands-on way to explore the SDK’s functionality.
While the original examples were provided in Java, this guide focuses on .NET. You can run the examples using Visual Studio, Visual Studio Code, or the CLI.
Prerequisites
Before you start with these examples, ensure you have:
Development Environment
Visual Studio (preferred) or Visual Studio Code.
.NET 6.0 or higher installed.
Project Setup
Access to the Unified Odds Feed .NET SDK project files.
Knowledge of building .NET projects from CLI if you plan to use commands like
dotnet build
ordotnet run
.
Access Credentials
A valid integration token to connect to the Unified Odds Feed.
Basic Knowledge
Familiarity with C# programming concepts.
Understanding of SDK initialization and running simple .NET programs.
Project Structure
Sportradar.OddsFeed.SDK.DemoProject/
├── App.config # SDK configuration
├── UofSdkExample.cs # Main program with example selection
├── Example/ # Example implementations
│ ├── Basic.cs
│ ├── MultiSession.cs
│ ├── SpecificDispatchers.cs
│ ├── ShowMarketNames.cs
│ ├── ShowEventInfo.cs
│ ├── CompleteInfo.cs
│ ├── ShowMarketMappings.cs
│ ├── ReplayServer.cs
│ └── CacheExportImport.cs
├── Utils/ # Utility classes
└── Logs/ # Log output directory
Available Examples
You can choose from the following examples when starting the SDK. Each example demonstrates a specific usage pattern or architecture for working with the Unified Odds SDK.
1. Basic SDK Setup
This example uses a single UofSession
configured with MessageInterest.AllMessages
, enabling full odds recovery from all producers. It focuses on SDK initialization and how to handle global and message-level events.
2. Multi-Session Architecture
In this setup, two parallel sessions are created—one with high priority and another with low priority. It highlights how to isolate sessions, filter messages based on priority, and handle events concurrently.
3. Event Type-Specific Handlers
Here, a single session is used, but each sport event type (such as Match, Stage, or Tournament) has its own dedicated handler. This pattern is ideal for processing different event types separately with custom logic.
4. Market Information
This example displays market data contained in each incoming message. It helps you explore market metadata and understand how market and outcome structures are represented in the feed.
5. Sport Event Information
In this example, each incoming message is enriched with SportEvent
details. It demonstrates the SportEvent
hierarchy and how to access related API calls for retrieving detailed event information.
6. Complete Information
This combines both market and sport event data in a single session. It also shows how to limit recovery using timestamps and provides deeper insights into market metadata, outcome structures, and the SportEvent
hierarchy.
7. Extra: Market Mapping Information
An additional example that focuses on market mappings. It shows how to access MarketMapping
metadata, including specifiers and structure details for each market received.
8. Extra: Replay Server
This example connects the SDK to the Replay Server. It allows you to replay previous sport events or entire scenarios, making it useful for testing integrations with historical data.
9. Extra: Cache Export / Import
This setup demonstrates how to serialize and deserialize the SDK cache to persist state across restarts. It’s useful for managing cache data, maintaining state, and optimizing performance.
Last updated
Was this helpful?