BetfairNG 1.6.1
dotnet add package BetfairNG --version 1.6.1
NuGet\Install-Package BetfairNG -Version 1.6.1
<PackageReference Include="BetfairNG" Version="1.6.1" />
<PackageVersion Include="BetfairNG" Version="1.6.1" />
<PackageReference Include="BetfairNG" />
paket add BetfairNG --version 1.6.1
#r "nuget: BetfairNG, 1.6.1"
#:package BetfairNG@1.6.1
#addin nuget:?package=BetfairNG&version=1.6.1
#tool nuget:?package=BetfairNG&version=1.6.1
Betfair API-NG C# Client API
A feature complete .NET Betfair API-NG C# client that builds on the Betfair sample code. It uses the Task Parallel Library and Reactive Extensions for the concurrency layer. Now with Exchange Streaming API support (early beta). Be sure to pull in the Betfair example code submodule:
git clone https://github.com/joelpob/betfairng
cd betfairng
git submodule init
git submodule update
How to use it
To login to Betfair using this library, you'll need both a) a self signed certificate (follow the process described here), and b) an application key directions here.
BetfairClient client = new BetfairClient("ASDF1234qwerty");
client.Login("client-2048.p12", "certpass", "username", "password");
Check out the ConsoleExample project (in the solution) for an example on how to use the "BetfairClient" class. If you're unfamiliar with the Task Parallel Library or Reactive Extensions, you can use the "BetfairClientSync" class.
The "MarketListener" class is where the magic happens:
AutoResetEvent waitHandle = new AutoResetEvent(false);
var marketListener = MarketListener.Create(client, BFHelpers.HorseRacePriceProjection(), 1);
var marketCatalogues = client.ListMarketCatalogue(
BFHelpers.HorseRaceFilter(),
BFHelpers.HorseRaceProjection(),
MarketSort.FIRST_TO_START,
25).Result.Response;
var marketCatalogue = marketCatalogues.First();
var marketSubscription = marketListener.SubscribeMarketBook(marketCatalogue.MarketId)
.SubscribeOn(Scheduler.Default)
.Subscribe(
tick =>
{
Console.WriteLine(BFHelpers.MarketBookConsole(marketCatalogue, tick, marketCatalogue.Runners));
},
() =>
{
Console.WriteLine("Market finished");
waitHandle.Set();
});
waitHandle.WaitOne();
marketSubscription.Dispose();
MarketListener will poll the Betfair API-NG service (ListMarketBook) for all subscribed markets and push the result to all Rx subscribers. You can also subscribe to individual runners in a given market (MarketListener.SubscribeRunner()).
Enjoy.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Newtonsoft.Json (>= 13.0.4)
- System.Collections.Immutable (>= 10.0.9)
- System.Reactive (>= 6.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.