RE: Programming your first Cryptobot

You are viewing a single comment's thread from:

Programming your first Cryptobot

in cryptocurrency •  7 years ago 

thank you very much for your post actually I am just trying to fetch the balance from bittrex using the api key but it doesnt seem to work
https://bittrex.com/api/v1.1/account/getbalance?apikey=key&currency=BTC
this url returns a false response
Capture.PNG
I researched a little bit more and I found something like we need to add nonce in the url so I appended nonce=str(time.time()) to the url
but still it gives some kind of error.
and it seems like the url requires some kind of signature inplace of apikey where the signature is some hash value

well whatever it is, can you please help me fetch the balance from bittrex
this is my basic code I tried

from urllib.parse import urlencode
import urllib.request
import json
import time
import hmac
import hashlib

values={}
secret='xxxxxxxxxxxxxxxxxxxxxxxxx'
key='xxxxxxxxxxxxxxxxxxxxxxx'
url = 'https://bittrex.com/api/v1.1/account/'
url += 'getbalance' + '?' + urlencode(values)
url += '&apikey=' + key
url += '&nonce=' + str(int(time.time()))
signature = hmac.new(b'key', url, hashlib.sha512).hexdigest()
headers = {'apisign': signature}
print (url)

this code still gives some error

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!