...
Code Block | ||
---|---|---|
| ||
def getMarketCatalouge(eventTypeID): if(eventTypeID is not None): print 'Calling listMarketCatalouge Operation to get MarketID and selectionId' endPoint = 'https://api.betfair.com/rest/v1.0/listMarketCatalogue/' now = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ') market_catalouge_req = '{"filter":{"eventTypeIds":["' + eventTypeID + '"],"marketCountries":["GB"],"marketStartTime":{"from":"' + now + '"}},"sort":"FIRST_TO_START","maxResults":"1","marketProjection":["RUNNER_METADATA"]}' market_catalouge_response = callAping(endPoint, market_catalouge_req) market_catalouge_loads = json.loads(market_catalouge_response) return market_catalouge_loads def getMarketId(marketCatalougeResult): if(marketCatalougeResult is not None): for market in marketCatalougeResult: return market['marketId'] def getSelectionId(marketCatalougeResult): if(marketCatalougeResult is not None): for market in marketCatalougeResult: return market['runners'][0]['selectionId'] marketCatalougeResult = getMarketCatalouge(horseRacingEventTypeID) marketid = getMarketId(marketCatalougeResult) runnerId = getSelectionId(marketCatalougeResult) |
Get Get available price for the next horse racing market using listMarketBook
...