You are viewing a single comment's thread from:

RE: Programming your first Cryptobot

in #cryptocurrency6 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

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.032
BTC 63572.52
ETH 3097.69
USDT 1.00
SBD 3.88