Giter Site home page Giter Site logo

scala-betfair's Introduction

Build Status

Betfair API written in Scala

A simple Scala library allowing you to authenticate with Betfair and query the exchange.

All operations operate asynchronously allowing for nice Scala for comprehension to chain and map results from the exchange.

Example Usage

List today's Horse Racing events:

object TodaysHorseRacingEvents extends ExampleApp {
  import betfair.ex
  
  val HorseRacingEventTypeId = "7"

  val horseRacingEvents = for {
    session <- betfair.login(MyCredentials)
    events <- betfair.listEvents(AuthorisedRequest(token = session.token, maxResults = 100, filter = MarketFilter(
      eventTypeIds = Set(HorseRacingEventTypeId),
      marketStartTime = Some(TimeRange.Today)
    )))
  } yield events

  horseRacingEvents onSuccess {
    case events =>
      events foreach println
      betfair.http.shutdown()
  }
}

This would output:

username: ********
password: ********
ListEventsResponse(Event(id : 27315292, name : TPara (US) 28th Nov, countryCode : Some(US), timezone : US/Arizona, openDate : 2014-11-28T19:55:00.000Z),2)
ListEventsResponse(Event(id : 27314820, name : ClubHip (CHL) 28th Nov, countryCode : Some(CL), timezone : America/Santiago, openDate : 2014-11-28T17:30:00.000Z),1)
ListEventsResponse(Event(id : 27314989, name : Hawth (US) 28th Nov, countryCode : Some(US), timezone : US/Central, openDate : 2014-11-28T19:50:00.000Z),6)
ListEventsResponse(Event(id : 27315216, name : DeltaD (US) 28th Nov, countryCode : Some(US), timezone : US/Central, openDate : 2014-11-28T23:50:00.000Z),2)
ListEventsResponse(Event(id : 27315266, name : Penn (US) 28th Nov, countryCode : Some(US), timezone : US/Eastern, openDate : 2014-11-28T23:00:00.000Z),6)

More examples

See the uk.co.softsquare.privetng.example package for further examples

scala-betfair's People

Contributors

oxlade39 avatar fermich avatar

Stargazers

 avatar SwhGo_oN avatar Pieter Kuijpers avatar Diogo Figueiredo avatar André Dumas avatar

Watchers

Nicola Piccinini avatar  avatar SwhGo_oN avatar James Cloos avatar

scala-betfair's Issues

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.