def getBetfairMarketList(self): # Get target markets for bot # - Currently anything on match oddss marketCatalogue = bf.listMarketCatalogue(self.betfairSessionKey, self.betfairAppKey, eventTypeIds = [1,2,3,4,5], marketBettingTypes="ODDS", marketTypeCodes=["MATCH_ODDS"], maxResults=50, turnInPlayEnabled=True) return marketCatalogue
def getMarketDetails(self): # Details from market catalogue marketCatalogue = bf.listMarketCatalogue(sessionKey=self.betfairSessionKey, appKey=self.betfairAppKey, marketIds=self.betfairMarketId) if marketCatalogue == []: print('Nothing returned') else: self.marketDetails = marketCatalogue[0] return self.marketDetails
dateStringUtc = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S:%fZ') futureDateStringUtc = (datetime.utcnow() + timedelta(hours=1)).strftime('%Y-%m-%d %H:%M:%S:%fZ') # write the time filter in JSON format as required by the API: timeFilter = '{"from":"' + dateStringUtc + '", "to":"' + futureDateStringUtc + '"}' #marketList = listMarketCatalogue(sessionKey,appKey,') ## # Read up to 20 horse races in the time filter" marketList = bf.listMarketCatalogue( sessionKey, appKey, eventTypeIds="1", marketBettingTypes="ODDS", marketTypeCodes=["MATCH_ODDS", "HALF_TIME_SCORE"], maxResults=3) # explain in comments what the options are in the listmarkets fucntion, and # explain the structure of the output too # marketList is returned as a cell-array of structures ( each element of # the cell-array contains a structure full of maret details) # to see datails of the first market, we can access it with > marketList{1}: market1 = marketList[0] # in the horse race example, we can see the first horse in the market by # accessing the "runners" field of the structure: horse1 = market1['runners'][0]