Jump to content

How can I fetch all matches in a market using the Stake API


Featured Comment

Posted (edited)

I'm building a Stake bot using the Stake API and have so far been able to collect the datas by copying a command through the Network-pan. 

I got this value as variables for the graphQL API call: 

`"variables\":{\"type\":\"upcoming\",\"limit\":100,\"offset\":0,\"groups\":\"Total\",\"sport\":\"soccer\"}}"`

but I unable to call all matches and all Asian Total markets. I'm only able to get the lowest value (eg. Over and Under 1.5) and only for the first 10 matches. I've modded the query to accept up to 49 matches. Is that the maximum I'm allowed to call?

Also if I use the query as shown above I get a value in data.slugSport.fixtureCount of the same value as displayed on the page. Is it possible to display all matches by just looping through each market (I think my code was wrong on my first attempt at this), and also return all Asian Total markets, or am I stuck with just the 49 matches, and only the lowest Asian Total available?

Any help and pointers would be greatly appreciated. Thanks in advance!

Edited by jonrhythmic
Link to comment
Share on other sites

  • 2 weeks later...

I'm still working on it, but have hit a roadblock where it keeps getting my account temporarily stopped by Cloudfront. Tried talking to support, but apperantly it's not allowed to make bots anymore, and any problems I encounter will be on me.

Link to comment
Share on other sites

Posted (edited)

Hello with this graphQl i can get all odds from all markets of respective event.

## GrapghQl Query

query_odds = """
query FixtureIndex(
  $fixture: String!,
  $groups: [String!]!
  ) {
  slugFixture(fixture: $fixture) {
    ...SportFixtureView
    groups {
      id
      ...SportGroup
    }
    group: groups(groups: $groups) {
      ...SportGroup
      templates {
        ...SportGroupTemplate
        markets {
          ...SportMarket
          outcomes {
            ...SportMarketOutcome
          }
        }
      }
    }
  }
}

fragment SportFixtureView on SportFixture {
  id
  slug
  extId
  status
  swishGame {
    id
    status
  }
  customBetAvailable
  betradarStream {
    exists
  }
  eventStatus {
    ...FixtureEventStatus
  }
  diceStream {
    exists
  }
  abiosStream {
    exists
    stream {
      startTime
      id
    }
  }
  data {
    ...SportFixtureDataMatch
    ...SportFixtureDataOutright
    __typename
  }
  contentNotes {
    ...ContentNote
  }
  tournament {
    id
    name
    slug
    contentNotes {
      ...ContentNote
    }
    category {
      id
      name
      slug
      contentNotes {
        ...ContentNote
      }
      sport {
        id
        name
        slug
        contentNotes {
          ...ContentNote
        }
      }
    }
  }
}

fragment FixtureEventStatus on SportFixtureEventStatus {
  homeScore
  awayScore
  matchStatus
  clock {
    matchTime
    remainingTime
  }
  periodScores {
    homeScore
    awayScore
    matchStatus
  }
  currentServer {
    extId
  }
  homeGameScore
  awayGameScore
  statistic {
    yellowCards {
      away
      home
    }
    redCards {
      away
      home
    }
    corners {
      home
      away
    }
  }
}

fragment SportFixtureDataMatch on SportFixtureDataMatch {
  startTime
  competitors {
    ...SportFixtureCompetitor
  }
  __typename
}

fragment SportFixtureCompetitor on SportFixtureCompetitor {
  name
  extId
  countryCode
  abbreviation
}

fragment SportFixtureDataOutright on SportFixtureDataOutright {
  name
  startTime
  endTime
  __typename
}

fragment ContentNote on ContentNote {
  id
  linkText
  linkUrl
  message
}

fragment SportGroup on SportGroup {
  name
  translation
  rank
}

fragment SportGroupTemplate on SportGroupTemplate {
  extId
  rank
  name
}

fragment SportMarket on SportMarket {
  id
  name
  status
  extId
  specifiers
  customBetAvailable
}

fragment SportMarketOutcome on SportMarketOutcome {
  active
  id
  odds
  name
  customBetAvailable
}
"""

request_data_odds = {
    "operationName": "FixtureIndex",
    "query": query_odds,
    "variables": {
        "fixture": slugs[fixture_index],
        "groups": ["main"],
    },
}

 

request_data_odds = {
    "operationName": "FixtureIndex",
    "query": query_odds,
    "variables": {
        "fixture": slugs[fixture_index],
        "groups": ["main"],
    },
 

##  Variables

request_data_odds = {
    "operationName": "FixtureIndex",
    "query": query_odds, ## Above query
    "variables": {
        "fixture": slugs[fixture_index], ## Id from respective match event, there is in response data thar element 'slug': desired id 
        "groups": ["main"],
    },

 

This API is amazing....

Obs:. This query and variables works for me with soccer matches

Edited by balbs89
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...