Skip to content

currentsea/FairlayPublicAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

This is a free service to scrape all markets on Fairlay. For all POST requests (creating/changing markets and orders) use the paid Private API.

  • The data on the free servers is updated every 5 seconds
  • For Professional Users there exist private servers with an update frequency of half a second. Please contact [email protected] to get access.
  • You have to accept GZIP, DEFLATE in your HEADER
  • Use the SoftChangedAfter parameter for incremental calls. Retrieve the server time and only query markets that have changed after your last request
  • 12 incremental calls are allowed per minute (the SoftChangedAfter parameter must be set to not more than 30 seconds in the past)
  • 1 call without a proper SoftChangedAfter parameter is allowed per IP per minute
  • When using the markets request make sure that your URI is not too long
  • All times are UTC (like DateTime.UtcNow, to account for any time difference with your developer machine grab Server Time, in the C# API all calls other than time will do this automatically for you)
  • Strings are not case sensitive

For more examples how this API should be used together with our paid API, please take a look at our sample clients in C# and Python.

Please feel free to comment and make suggestions.

Free Servers

http://31.172.83.181:8080 (used by default for all Public API calls)
http://31.172.83.53:8080 (is an alternate server with the same functionality, also used for all Private API calls)

View markets on Fairlay

You can use the market ids to access any market on fairlay directly

https://fairlay.com/market/MARKETID

Example:

https://fairlay.com/market/will-donald-trump-be-president-at-year-end-2018/


Methods

For examples on how to use each of the API calls presented here, see the C# Unit Tests.

In all of the examples below you can call /free/(method) calls with /free0/ up to /free9/ to increase the given limits above, a simple way is to either rotate from 1 to 9 or just randomize the free call from 1 to 9.

Server Time

Returns the server time in ticks.

http://31.172.83.181:8080/free/time

Note: You can do the same in the Private API via getservertime

Markets

Returns JSON encoded list of markets that apply to the given filter.

http://31.172.83.181:8080/free/markets/JSON-ENCODED-MARKETFILTER

MARKETFILTER object looks like this:

{
        "Cat":0,
        "RunnerAND":["Arsenal","Chelsea"],
        "TitleAND":null,
        "TitleNOT":["Corners","Throwin"],
        "Comp":"Premier League",
        "TypeOR":[0],
        "PeriodOR":[1],
        "SettleOR":null,
        "Descr":null,
        "ChangedAfter":"2016-01-01T22:01:01",
        "SoftChangedAfter":"0001-01-01T00:00:00",
        "OnlyActive":false,
        "NoZombie":false,
        "FromClosT":"2016-05-01T00:00:00",
        "ToClosT":"0001-01-01T00:00:00",
        "FromID":0,
        "ToID":10000
}

Cat: Category, see A2) for more information. 0 queries all Categories. TitleAND: List of strings which all must appear in the title of the market. RunnerAND: List of strings which all must be contained in at least one name of one runner of the market. *TitleNOT: List of strings which none may appear in the title of the market. Comp: Competition name. null to get all competitions. TypeOr: Market Types, see A2) for more information. Only the Market Types given will be returned. If set to null, all market types will be returned. PeriodOr: Market Period, see A2) for more information. SettleOr: Settlement Type, see A2) for more information. NoZombie: If True, no empty markets will be returned (without any open order). Descr: The given string must appear in the market description. ChangedAfter: Return markets where the meta data was changed after the given date. Usually the Closing and Settlement Dates of a market is the only data that changes. SoftChangedAfter: Return all markets, where either the the meta data or the orderbook has changed since the given date. FromClosT: Return markets where the closing time is greater than the given one. FromID and ToID: Use for paging requests. ToID has a default value of 300 if not set.

Examples:

Returns the first 100 non-empty soccer markets, where one of the runners is Portugal, the Title does not contain the words "Corners" or "Throwin" and the period of the match is full-time.

http://31.172.83.181:8080/free/markets/{"Cat":1,"NoZombie":true,"RunnerAND":["Portugal"], "TitleNOT":["Corners","Throwin"], "PeriodOR":[1],"FromID":0,"ToID":100}


Returns all active tennis matches of the type Over/Under or Outright where the odds or market data have changed after June 1st 12:01:30pm.

http://31.172.83.181:8080/free/markets/{"Cat":2,"TypeOr":[1,2],"SoftChangedAfter":"2016-06-01T12:01:30","OnlyActive":true,"ToID":10000}


Returns all active non-empty markets.

http://31.172.83.181:8080/free/markets/{"OnlyActive":true,"NoZombie":true,"ToID":100000}


Competitions

Returns all competitions in the selected category.

http://31.172.83.181:8080/free/comps/CATEGORYID


Example for all soccer competitions:

http://31.172.83.181:8080/free/comps/1


A2) DATA Fields

enum MarketPeriod
        UNDEFINED,
        FT,
        FIRST_SET,
        SECOND_SET,
        THIRD_SET,
        FOURTH_SET,
        FIFTH_SET,
        FIRST_HALF,
        SECOND_HALF,
        FIRST_QUARTER,
        SECOND_QUARTER,
        THIRD_QUARTER,
        FOURTH_QUARTER,
        FIRST_PERIOD,
        SECOND_PERIOD,
        THIRD_PERIOD,

enum StatusType
        ACTIVE,
        INPLAY,
        SUSPENDED,
        CLOSED,
        SETTLED,
        CANCELLED

enum MarketType
        M_ODDS,
        OVER_UNDER,
        OUTRIGHT,
        GAMESPREAD,
        SETSPREAD,
        CORRECT_SCORE,
        FUTURE,
        BASICPREDICTION,
        RESERVED2,
        RESERVED3,
        RESERVED4,
        RESERVED5,
        RESERVED6

enum SettleType
        BINARY,
        DECIMAL

Category:
        SOCCER = 1;
        TENNIS = 2;
        GOLF = 3;
        CRICKET = 4;
        RUGBYUNION = 5;
        BOXING = 6;
        HORSERACING = 7;
        MOTORSPORT = 8;
        SPECIAL = 10;
        RUGBYLEAGUE = 11;
        BASKETBALL = 12;
        AMERICANFOOTBALL = 13;
        BASEBALL = 14;
        POLITICS = 15;
        FINANCIAL = 16;
        GREYHOUND = 17;
        VOLLEYBALL = 18;
        HANDBALL = 19;
        DARTS = 20;
        BANDY = 21;
        WINTERSPORTS = 22;
        BOWLS = 24;
        POOL = 25;
        SNOOKER = 26;
        TABLETENNIS = 27;
        CHESS = 28;
        HOCKEY = 30;
        FUN = 31;
        ESPORTS = 32;
        RESERVED4 = 34;
        MIXEDMARTIALARTS = 35;
        RESERVED6 = 36;
        RESERVED = 37;
        CYCLING = 38;
        RESERVED9 = 39;

API Examples & Source Code

Public API - Python Public API - Using Example

About

Fairlay's Public API documentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages