Jump to content
Dan

Using the Stake API

Featured Comment

Hi, I wanna make an auto-betting bot for League Of Legends

@Dan Can you please help me which API calls would I need for this instance?

I would like to get list of active games + betting options and an API Call to bet.

 

I was using Selenium before, which didn't really work out.

 

Share this post


Link to post
Share on other sites
On 5/15/2020 at 8:56 AM, Lanfaster said:

Can somebody please give me an example of this used in PHP CURL or PYTHON

Not exactly sure what you're asking for, as theres many different queries/requests that can be made through the API. Also, cURL has a library for PHP but out of the box it runs from command line, while as PHP and python are programming languages. Please be more specific with what you're even trying to accomplish in order for anyone to help you.

Share this post


Link to post
Share on other sites
On 5/15/2020 at 10:56 PM, Lanfaster said:

Can somebody please give me an example of this used in PHP CURL or PYTHON

$query = array(
  'query' => 'mutation ($userId: String!, $amount: Float!, $currency: CurrencyEnum!, $isPublic: Boolean, $chatId: String! ) { sendTip(userId: $userId, amount: $amount, currency: $currency, isPublic: $isPublic, chatId: $chatId) {id} }',
  'variables' => array(
        'userId' => $id,
        'amount' => $amount,
        'currency' => 'btc',
        'isPublic' => true,
        'chatId' => 'f0326994-ee9e-411c-8439-b4997c187b95'
  )
);

$data_string = json_encode($query);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.stake.com/graphql");                                                                     
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',
    'x-access-token: ' . $TOKEN,                                                                                
    'Content-Length: ' . strlen($data_string))                                                                       
);
$response = curl_exec($ch);
curl_close ($ch);

 

On 5/31/2020 at 3:53 AM, Sunneys said:

Hi, I wanna make an auto-betting bot for League Of Legends

@Dan Can you please help me which API calls would I need for this instance?

I would like to get list of active games + betting options and an API Call to bet.

 

I was using Selenium before, which didn't really work out.

 

Hi mate, if you wish to make an autobetting bot, you would need programming experience already as its a very difficult thing to make. If you are here asking me how to make one, it's very unlikely we will be able to help you through this project.

Share this post


Link to post
Share on other sites
7 hours ago, Dan said:

$query = array(
  'query' => 'mutation ($userId: String!, $amount: Float!, $currency: CurrencyEnum!, $isPublic: Boolean, $chatId: String! ) { sendTip(userId: $userId, amount: $amount, currency: $currency, isPublic: $isPublic, chatId: $chatId) {id} }',
  'variables' => array(
        'userId' => $id,
        'amount' => $amount,
        'currency' => 'btc',
        'isPublic' => true,
        'chatId' => 'f0326994-ee9e-411c-8439-b4997c187b95'
  )
);

$data_string = json_encode($query);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.stake.com/graphql");                                                                     
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',
    'x-access-token: ' . $TOKEN,                                                                                
    'Content-Length: ' . strlen($data_string))                                                                       
);
$response = curl_exec($ch);
curl_close ($ch);

 

Hi mate, if you wish to make an autobetting bot, you would need programming experience already as its a very difficult thing to make. If you are here asking me how to make one, it's very unlikely we will be able to help you through this project.

I already have programming experience, Just I'm not really familiar with GraphQL and it's requests body's.

As i said i attempted to make the bot through selenium, which didn't go really well.

 

What I'm asking for is the exact GraphQL queries I would need to use for this instance. 

I believe these are the ones I need:

  • Get list of active games for the game
  • Query to see bet options
  • Query to bet

Share this post


Link to post
Share on other sites

Hello @Dan... Confirm Support On Provide Punctually The Information From The Next Two Support Request... Confirm Support First On Confirm The Reason My Api Private Key Pass Start’s From Today Continuously Change... Additionally Confirm Second Support On Confirm If There’s A Limit For Api For Realize Bet Order’s Per MiliSecond’s And/Or Per Ip Address... Appreciate Your Perfect Support On The Request Realized...

Share this post


Link to post
Share on other sites
Posted (edited)
9 minutes ago, Andres F. Jllo. said:

Hello @Dan... Confirm Support On Provide Punctually The Information From The Next Two Support Request... Confirm Support First On Confirm The Reason My Api Private Key Pass Start’s From Today Continuously Change... Additionally Confirm Second Support On Confirm If There’s A Limit For Api For Realize Bet Order’s Per MiliSecond’s And/Or Per Ip Address... Appreciate Your Perfect Support On The Request Realized...

Reading something that starts with capital character isn't easy to follow.

The API Key might get a change periodically for security purposes (you wouldn't like it if someone would find/guess your key somehow and use it).

As of the limit you can bet I'd say is dependent on the number of requests you make to the server (but around 0.5-1.5 bets per second is what I've encountered).

Edited by skywallkee

Share this post


Link to post
Share on other sites
1 hour ago, Andres F. Jllo. said:

@Dan@skywallkee Confirm Perfect... Capital Be From IPhone Corrector... Confirm Additionally Support On Where Can Find All The Api Documentation For Know The New Recent Api Changes... Appreciate Your Support...

As I have stated on the last post on page 6 and is also mentioned in the main topic, currently there is no public documentation, reason why this topic has been created, so that everyone that needs something from the API, they can simply ask. It is planned to be released sometimes in the future for a proper documentation, but nothing certain has been announced. Please check out the rest of the posts as these kind of questions have been answered and re-answered, so many of the questions you might have definitely will have an answer in this topic.

Share this post


Link to post
Share on other sites
On 6/1/2020 at 9:33 AM, Sunneys said:
  • Query to bet

This is something I would also like to know.

I have found a way to find sportbets (listed in previous posts), but no command to place a bet...

Share this post


Link to post
Share on other sites
2 hours ago, cryptonesiac said:

This is something I would also like to know.

I have found a way to find sportbets (listed in previous posts), but no command to place a bet...

Depends on which game. You have at page 4  an answer with the queries for most games:

  

On 1/10/2020 at 5:08 PM, toohoola said:

I'm not @Dan, but yes, it is possible:


query BetList($user: String) {
	user(name: $user) {
		houseBetList(limit: 50, offset: 0) {
			...BetFragment
		}
	}
}

fragment BetFragment on Bet {
	id
	iid
	type
	bet {
		... on CasinoBet {
			...CasinoBetFragment
		}
		... on MultiplayerCrashBet {
			...MultiplayerCrashBetFragment
		}
	}
}

fragment CasinoBetFragment on CasinoBet {
	id
	active
	payoutMultiplier
	amountMultiplier
	amount
	payout
	updatedAt
	currency
	game
	state {
		... on CasinoGameDice {
			...DiceStateFragment
		}
		... on CasinoGameLimbo {
			...LimboStateFragment
		}
		... on CasinoGameHilo {
			...HiloStateFragment
		}
		... on CasinoGameKeno {
			...KenoStateFragment
		}
		... on CasinoGameMines {
			...MinesStateFragment
		}
		... on CasinoGamePlinko {
			...PlinkoStateFragment
		}
		... on CasinoGameBlackjack {
			...BlackjackStateFragment
		}
		... on CasinoGameRoulette {
			...RouletteStateFragment
		}
		... on CasinoGameVideoPoker {
			...VideoPokerStateFragment
		}
		... on CasinoGameWheel {
			...WheelStateFragment
		}
		... on CasinoGameDiamondPoker {
			...DiamondPokerStateFragment
		}
		... on CasinoGameBaccarat {
			...BaccaratStateFragment
		}
		... on CasinoGameSlots {
			...SlotsStateFragment
		}
	}
}

fragment DiceStateFragment on CasinoGameDice {
	dice_result: result
	dice_target: target
	dice_condition: condition
}

fragment LimboStateFragment on CasinoGameLimbo {
	limbo_result: result
	limbo_multiplierTarget: multiplierTarget
}

fragment HiloStateFragment on CasinoGameHilo {
	hilo_startCard: startCard {
		suit
		rank
	}
	hilo_rounds: rounds {
		card {
			suit
			rank
		}
		guess
		payoutMultiplier
	}
}

fragment KenoStateFragment on CasinoGameKeno {
	keno_drawnNumbers: drawnNumbers
	keno_selectedNumbers: selectedNumbers
}

fragment MinesStateFragment on CasinoGameMines {
	mines_mines: mines
	mines_minesCount: minesCount
	mines_rounds: rounds {
		field
		payoutMultiplier
	}
}

fragment PlinkoStateFragment on CasinoGamePlinko {
	plinko_risk: risk
	plinko_rows: rows
	plinko_point: point
	plinko_path: path
}

fragment BlackjackStateFragment on CasinoGameBlackjack {
	blackjack_player: player {
		value
		actions
		cards {
			rank
			suit
		}
	}
	blackjack_dealer: dealer {
		value
		actions
		cards {
			rank
			suit
		}
	}
}

fragment RouletteStateFragment on CasinoGameRoulette {
	roulette_result: result
	roulette_colors: colors {
		amount
		value
	}
	roulette_numbers: numbers {
		amount
		value
	}
	roulette_parities: parities {
		amount
		value
	}
	roulette_ranges: ranges {
		amount
		value
	}
	roulette_rows: rows {
		amount
		value
	}
}

fragment VideoPokerStateFragment on CasinoGameVideoPoker {
	videopoker_playerHand: playerHand {
		suit
		rank
	}
	videopoker_initialHand: initialHand {
		suit
		rank
	}
	videopoker_handResult: handResult
}

fragment WheelStateFragment on CasinoGameWheel {
	wheel_result: result
	wheel_segments: segments
	wheel_risk: risk
}

fragment DiamondPokerStateFragment on CasinoGameDiamondPoker {
	diamondpoker_dealerHand: dealerHand
	diamondpoker_playerHand: playerHand
}

fragment BaccaratStateFragment on CasinoGameBaccarat {
	baccarat_playerCards: playerCards {
		suit
		rank
	}
	baccarat_bankerCards: bankerCards {
		suit
		rank
	}
	baccarat_tie: tie
	baccarat_player: player
	baccarat_banker: banker
	baccarat_result: result
}

fragment SlotsStateFragment on CasinoGameSlots {
	slots_lines: lines
	slots_rounds: rounds {
		offsets
		paylines {
			payline
			hits
			multiplier
			symbol
		}
		scatterMultiplier
		roundMultiplier
		totalMultiplier
		bonusRemaining
		bonusTotal
	}
}

fragment MultiplayerCrashBetFragment on MultiplayerCrashBet {
	id
	user {
		id
		name
	}
	payoutMultiplier
	gameId
	amount
	payout
	currency
	result
	updatedAt
	cashoutAt
	btcAmount: amount(currency: btc)
	ethAmount: amount(currency: eth)
	ltcAmount: amount(currency: ltc)
	bchAmount: amount(currency: bch)
	dogeAmount: amount(currency: doge)
	trxAmount: amount(currency: trx)
	xrpAmount: amount(currency: xrp)
}

 

As I mentioned in a post above, just look in this topic, the chances of someone to have already asked for what you're looking are really high.

Share this post


Link to post
Share on other sites

Hello, 

I want to connect to stake websockets api and on local connects perfectly, but on my serwer since today it stopped connecting - I receive event onerror and thats all (before connection on server worked perfectly). What can go wrong here?

Share this post


Link to post
Share on other sites
19 minutes ago, suchi1 said:

Hello, 

I want to connect to stake websockets api and on local connects perfectly, but on my serwer since today it stopped connecting - I receive event onerror and thats all (before connection on server worked perfectly). What can go wrong here?

I think you need to be a little more specific. You can't make any request to the API, or you can and get a response? If you can and get a response, the error might be useful.

Share this post


Link to post
Share on other sites
27 minutes ago, skywallkee said:

I think you need to be a little more specific. You can't make any request to the API, or you can and get a response? If you can and get a response, the error might be useful.

I am not making REST requests to the API. I dont have any response or any error code/text. Just information that connection failed.

Share this post


Link to post
Share on other sites
4 hours ago, skywallkee said:

Depends on which game. You have at page 4  an answer with the queries for most games:

As I mentioned in a post above, just look in this topic, the chances of someone to have already asked for what you're looking are really high.

I have been following this thread since the first post, but I was specifically asking for placing a sports bet

Share this post


Link to post
Share on other sites
On 6/25/2020 at 9:52 PM, thisgamecheats said:

hi Dan, sorry if I missed it but I dont see an example for the Wheel game. any chance we can get the necessary query and mutations it requires?

 

I'd like to second this request for the Wheel Game. 

Share this post


Link to post
Share on other sites

Hi,

 

is there a query for the leaderboard in the current race if one is active?

Edited by Joe

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×