...
We maintain sample code in Java & C# here: https://github.com/betfair/stream-api-sample-code
Stream API Specification & Swagger Definition
We provide a Swagger schema to allow specification browsing & code generation for various languages; please use:
Swagger: http://editor.swagger.io/#/
Swagger Definition:
Sample Application - C# & Java
A console based C# & Java sample application is available for the Market & Order Streaming API and is available via https://github.com/betfair/stream-api-sample-code/blob/master/ESASwaggerSchema.json
To generate a client for the programming language of your choice:
...
Info |
---|
Note: Any fields representing time and having a long type will represent the UNIX Timestamps (See https://currentmillis.com/ for conversions) |
...
title | Json Deserializers |
---|
...
Users wishing to interact with the Streaming API using one of these languages are strongly advised to make use of this sample code.
Swagger Definition
For users wishing to use other languages or develop their own implementation, we provide a swagger schema to allow browsing & code generation.
We recommend using Swagger Code Gen (http://swagger.io/swagger-codegen/) for generation,
- As a pre-requisite Java version 7 or higher must be installed
- Download both,
- The Swagger Code Gen jar from: https://oss.sonatype.org/content/repositories/releases/io/swagger/swagger-codegen-cli/2.2.1/swagger-codegen-cli-2.2.1.jar
- The Swagger Definition from our GitHub repository: https://github.com/betfair/stream-api-sample-code/blob/master/ESASwaggerSchema.json
- Run the following command to view a list of available languages to generate code for: java -jar swagger-codegen-cli-2.2.1.jar
- Run the following command to generate the code: java -jar swagger-codegen-cli-2.2.1.jar generate -i ESASwaggerSchema.json -l <LANGUAGE> -o <OUTPUT_DIRECTORY>
The Swagger editor can also be used to view the domain model
- http://editor.swagger.io/#!/
- Use File -> Import File and choose the Swagger Definition downloaded from our GitHub repository
Info | ||
---|---|---|
| ||
| ||
Tip | ||
|
Typical Interactions with Stream API:
...
- orderFilter (optional)
OrderFilter
This optional filter already filters by your account; but additional data shaping is supported
...
Line Markets
Line markets being sent on the Market Stream can be identified by the bettingType field of MarketDefinition (with value of "LINE").
The MarketDefinition of Line markets provide some additional fields that will be null for all other types,
- lineMaxUnit - maximum value for the outcome, in market units for this market (eg 100 runs).
- lineMinUnit - minimum value for the outcome, in market units for this market (eg 0 runs).
- lineInterval - the odds ladder on this market will be between the range of lineMinUnit and lineMaxUnit, in increments of the interval value.e.g. If lineMinUnit=10 runs, lineMaxUnit=20 runs, lineInterval=0.5 runs, then valid odds include 10, 10.5, 11, 11.5 up to 20 runs.
For updates for Orders on Line markets received on the Order Stream be aware of how the following properties behave,
- price - line markets operate at even-money odds of 2.0. However, price for these markets refers to the line positions available as defined by the markets min-max range and interval steps.
- side - for Line markets a 'B' bet refers to a SELL line and an 'L' bet refers to a BUY line.
- averagePriceMatched - this value is not meaningful for activity on Line markets and is not guaranteed to be returned or maintained for these markets.
...