Betfair.Interfaces 1.0.0-alpha-0

This is a prerelease version of Betfair.Interfaces.
dotnet add package Betfair.Interfaces --version 1.0.0-alpha-0
                    
NuGet\Install-Package Betfair.Interfaces -Version 1.0.0-alpha-0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Betfair.Interfaces" Version="1.0.0-alpha-0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Betfair.Interfaces" Version="1.0.0-alpha-0" />
                    
Directory.Packages.props
<PackageReference Include="Betfair.Interfaces" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Betfair.Interfaces --version 1.0.0-alpha-0
                    
#r "nuget: Betfair.Interfaces, 1.0.0-alpha-0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Betfair.Interfaces@1.0.0-alpha-0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Betfair.Interfaces&version=1.0.0-alpha-0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Betfair.Interfaces&version=1.0.0-alpha-0&prerelease
                    
Install as a Cake Tool

.NET Core GitHub license NuGet downloads

Quality Gate Status Security Rating Bugs Code Smells Coverage Duplicated Lines (%)

Mutation testing badge

Betfair

Fast and simple classes for interacting with the Betfair API and Stream.

I'm passionate about this library and love hearing from users! Join our Discussions to ask questions, share your experiences, or suggest new features. Your feedback helps make this library better for everyone.

Full documentation.

Installation

Available on NuGet

dotnet add package Betfair

or

PM> Install-Package Betfair

How to Subscribe to a Market Stream

Create a Subscription, define your filters, and run the zero-allocation market cache.
Full subscription documentation.

var credentials = new Credentials("USERNAME", "PASSWORD", "APP_KEY");
using var subscription = new Subscription(credentials);

var filter = new StreamMarketFilter().WithMarketIds("MARKET_ID");
var data = new DataFilter().WithBestPrices().WithLastTradedPrice();

await subscription.RunMarketCache(filter, data, onUpdate: processor =>
{
    var market = processor.GetMarket("MARKET_ID");
    if (market is null) return;

    foreach (var runner in market.RunnerSpan)
    {
        var bestBack = runner.BestAvailableToBack.GetPrice(0);
        var bestLay = runner.BestAvailableToLay.GetPrice(0);
        // React to price changes with minimal latency
    }
}, cancellationToken: cts.Token);

Optional Logging

Enable structured logging of connection lifecycle events (connect, reconnect, errors) by passing a logger:

using var subscription = new Subscription(credentials, new SubscriptionOptions
{
    Logger = loggerFactory.CreateLogger<Subscription>()
});

How to List Today's Horse Races

var credentials = new Credentials("USERNAME", "PASSWORD", "APP_KEY");

using var client = new BetfairApiClient(credentials);

var filter = new ApiMarketFilter()
    .WithMarketTypes(MarketType.Win)
    .WithCountries(Country.UnitedKingdom, Country.Ireland)
    .WithEventTypes(EventType.HorseRacing)
    .FromMarketStart(DateTimeOffset.UtcNow)
    .ToMarketStart(DateTimeOffset.UtcNow.AddDays(1));

var query = new MarketCatalogueQuery()
    .Include(MarketProjection.Event)
    .Include(MarketProjection.MarketStartTime)
    .Include(MarketProjection.MarketDescription)
    .Include(MarketProjection.RunnerDescription)
    .OrderBy(MarketSort.FirstToStart)
    .Take(200);

var marketCatalogues = await client.MarketCatalogue(filter, query);

Or use the helper extension.

var filter = new ApiMarketFilter()
    .TodaysCard();

var query = new MarketCatalogueQuery()
    .Include(MarketProjection.Event)
    .Include(MarketProjection.MarketStartTime)
    .Include(MarketProjection.MarketDescription)
    .Include(MarketProjection.RunnerDescription)
    .OrderBy(MarketSort.FirstToStart)
    .Take(200);

var marketCatalogues = await client.MarketCatalogue(filter, query);
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha-0 90 7/8/2026