cryptonesiac Posted June 9, 2019 #1 Posted June 9, 2019 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!
williamshennie9 Posted June 9, 2019 #2 Posted June 9, 2019 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
Kate Posted June 9, 2019 #4 Posted June 9, 2019 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.
cryptonesiac Posted June 9, 2019 Author #5 Posted June 9, 2019 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
cryptonesiac Posted June 10, 2019 Author #7 Posted June 10, 2019 Hmmm, maybe I'm stupid... but this is the outcome (censored the ID, just in case): https://pastebin.com/raw/PLm4Bb9G
hui Posted June 10, 2019 #8 Posted June 10, 2019 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.
cryptonesiac Posted June 10, 2019 Author #9 Posted June 10, 2019 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
hui Posted June 10, 2019 #10 Posted June 10, 2019 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 hehe i definitely didn't change anything but anything that works, i guess
ilovespoons444 Posted May 11, 2020 #11 Posted May 11, 2020 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!
cryptonesiac Posted May 11, 2020 Author #12 Posted May 11, 2020 Most info can be found here... I'm not an expert either, but managed to get some things done in Python:
Featured Comment
Archived
This topic is now archived and is closed to further replies.