Jump to content

Featured Comment

Hi everyone,

I'm entering a new world of trying to connect to the API. So far I have been able to connect, bet and change the bet amount under certain conditions.

Now, I'm trying to fetch some data, for example my balance. I've tried some things in the Playground (https://api.stake.com/graphql) but to no avail :(

Could someone provide me the JSON string to query my balance? I think if I have seen some more examples, I can figure out most of the other settings. Thanks in advance!

Share this post


Link to post
Share on other sites

I'm going to tag @Dan. He is usually the go-to person when it comes to the API. I once needed help with the API, and Dan helped me very easily. Hopefully he sees this and helps you :D

Share this post


Link to post
Share on other sites

Umm why do you need it tho ? Because if you already have the bet amount changer it looks like you want to create a bot for a certain game. 

Share this post


Link to post
Share on other sites
1 hour ago, Kate said:

Umm why do you need it tho ? Because if you already have the bet amount changer it looks like you want to create a bot for a certain game. 

I want the bet amount being dependent on my balance... for example: high balance --> high bet amount, low balance --> low bet amount

Share this post


Link to post
Share on other sites
3 minutes ago, cryptonesiac said:

Hmmm, maybe I'm stupid... but this is the outcome (censored the ID, just in case):

https://pastebin.com/raw/PLm4Bb9G

that's strange, my output looks more or less like this: (i obviously changed id and some numbers)

Quote

[{"data":{"user":{"id":"70d3d80b-9b77-4ca3-bfd1-fcabcdd0db58","balances":[{"available":{"currency":"bch","amount":0.12345711908036148,"__typename":"Balance"},"__typename":"UserBalance"},{"available":{"currency":"btc","amount":0.234561595439795773,"__typename":"Balance"},"__typename":"UserBalance"},{"available":{"currency":"doge","amount":0.3456797704543,"__typename":"Balance"},"__typename":"UserBalance"},{"available":{"currency":"eth","amount":0.4567850066562882,"__typename":"Balance"},"__typename":"UserBalance"},{"available":{"currency":"ltc","amount":0.567890529888832749,"__typename":"Balance"},"__typename":"UserBalance"}],"__typename":"User"}}}]

it is also the exact same way as the site gets the balances, too. for reference here is the corresponding curl command, that creates the above output for me (with the api key removed):

Quote

curl 'https://api.stake.com/graphql' -H 'accept: */*' -H 'Referer: https://stake.com/' -H 'Origin: https://stake.com' -H 'x-lockdown-token: undefined' -H 'x-access-token: REMOVED' -H 'content-type: application/json' --data-binary '[{"operationName":"StakeBalances","variables":{"available":true,"vault":false},"query":"query StakeBalances($available: Boolean = false, $vault: Boolean = false) {\n  user {\n    id\n    balances {\n      available @include(if: $available) {\n        currency\n        amount\n        __typename\n      }\n      vault @include(if: $vault) {\n        currency\n        amount\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n"}]' --compressed

it works like a charme for me.

Share this post


Link to post
Share on other sites
query StakeBalances($available: Boolean = false, $vault: Boolean = false) {

first Boolean = false should become Boolean = true

query StakeBalances($available: Boolean = true, $vault: Boolean = false) {

then it's working like a charm! Thanks a lot :D

Share this post


Link to post
Share on other sites
28 minutes ago, cryptonesiac said:

query StakeBalances($available: Boolean = false, $vault: Boolean = false) {

first Boolean = false should become Boolean = true


query StakeBalances($available: Boolean = true, $vault: Boolean = false) {

then it's working like a charm! Thanks a lot :D

hehe i definitely didn't change anything but anything that works, i guess :)

Share this post


Link to post
Share on other sites
Posted (edited)
On 6/9/2019 at 1:01 PM, cryptonesiac said:

Hi everyone,

I'm entering a new world of trying to connect to the API. So far I have been able to connect, bet and change the bet amount under certain conditions.

Now, I'm trying to fetch some data, for example my balance. I've tried some things in the Playground (https://api.stake.com/graphql) but to no avail :(

Could someone provide me the JSON string to query my balance? I think if I have seen some more examples, I can figure out most of the other settings. Thanks in advance!

Hey cryptonesiac,

Somewhat similarly, I'm pretty inexperienced with APIs and couldn't find any stakeAPI documentation but I'm struggling to even get the first stage 😄 Would you mind sharing your code that allowed to you connect and bet? Are you using python?

Any help would be greatly aprpeciated, cheers man! 

Edited by ilovespoons444 | rewording

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×