Giter Club home page Giter Club logo

pinnaclewrapper's Introduction

C# Wrapper for the PinnacleSports API

A complete API client that builds on the PinnacleSports API Documentation

Update

2.1

  • Feature : New constructor that accepts an HttpClient
  • Feature : HttpClientFactory.GetNewInstance can be used to instantiate an HttpClient with necessary headers & baseUrl for Pinnacle's Api, with GZIP option
  • Bug fix : Fixed issue that was causing all limits returned by GetOdds to be in USD regardless of the currency provided
  • Bug fix : Now correctly populates Team Totals properties from GetOdds call
  • Breaking changes : PlaceBetResponse.UniquerequestId renamed PlaceBetResponse.UniqueRequestId
  • Breaking changes : Currency.rate renamed Currency.Rate

2.0

  • First version published on nuget.org
  • Library now targeting .netstandard 2.0 so should work from both .Net Framework 4.7.2 and .Net Core 2.2 projects
  • You can override the default version, v1, for the Fixtures and Odds requests
  • PinnacleClient constructor now has an optional baseUrl parameter, default value https://api.pinnacle.com
  • GetFeed functionalities removed as they are deprecated by Pinnacle, use GetFixtures and GetOdds instead. If you need GetFeed revert to v1.0 of this library.

References

These references are available via NuGet.

  • Newtonsoft.Json
  • Microsoft.AspNet.WebApi.Client package

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 client.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!

pinnaclewrapper's People

Contributors

anderj017 avatar harveysburger avatar nbezembinder1 avatar richardsilveira avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.