harveysburger / pinnaclewrapper

A C# Wrapper for the PinnacleSports API
25 stars 56 forks source link
pinnacle pinnaclesports-api sportsbetting

C# Wrapper for the PinnacleSports API

A complete API client that builds on the PinnacleSports API Documentation

Update

2.1

2.0

References

These references are available via NuGet.

Usage

Here's an example of getting all lines for upcoming Tennis matches (across all leagues):

var httpClient = HttpClientFactory.GetNewInstance("username", "password");

var api = new PinnacleClient("AUD", OddsFormat.DECIMAL, httpClient);

// 33 is the Tennis SportId. This gets all Events currently offered
var fixtures = await api.GetFixtures(new GetFixturesRequest(33));

// this retrieves the odds that correspond to each fixture.
var odds = await api.GetOdds(new GetOddsRequest(33));

Refreshing lines:

Use the "since" parameter with GetFixtures (update current events) and GetOdds (get latest odds).

Example (continuing from above):

Thread.Sleep(5000);  // wait between calls one way or another. Calling the API too aggressively may get you blocked from using the API.
var oddsChanges = await _client.GetOdds(new GetOddsRequest(33, odds.Last));   

This library started off as a cleaned up version by anderj017 of the Pinnacle API wrapper created by Nuno Freitas and has been extended and tweaked by various people since.

The initial location of this wrapper was https://github.com/anderj017/pinnaclewrapper

Enjoy!