Hello,
i'm trying to use the Bittrex WEB API V3 via a simple Python Script for placing Orders or getting the actual User Balance without !!! using any Bittrex spec. Library.
Unfortunately i have no Chance to have success with this.
I'm using this method for the Finance API without any Problems...
def getBalanceBN(curr):
import requests, time, hmac, hashlib, json, base64, urllib
from urllib.parse import urlencode
BASE_URL = 'https://api.binance.com'
url_path = '/api/v3/account'
payload = {
}
query_string = urlencode(payload, True)
if query_string:
query_string = "{}×tamp={}".format(query_string, int(time.time() * 1000))
else:
query_string = 'timestamp={}'.format(int(time.time() * 1000))
hashstr = hmac.new(bin_secret.encode('utf-8'), query_string.encode('utf-8'), hashlib.sha256).hexdigest()
url = BASE_URL + url_path + '?' + query_string + '&signature=' + hashstr
params = {'url': url, 'params': {}}
session = requests.Session()
session.headers.update({
'Content-Type': 'application/json;charset=utf-8',
'X-MBX-APIKEY': bin_key
})
try:
r = r = session.get(**params)
balance_array = (json.loads(r.text)['balances'])
#print(r.text)
for i in range(len(balance_array)):
if balance_array[i]['asset'] == curr:
Balance = balance_array[i]['free']
log('Binance Balance for ' + curr + ' = ' + str(Balance))
return (Balance)
if r.status_code != 200:
print("API Error Code " + str(r.status_code))
log("Error querying Binane API for User Balance API Error Code " + str(r.status_code))
log(r.text)
return ('error')
return(0)
except requests.ConnectionError:
log("Error querying Binane API for getting User Balance " )
return ('error')
I'm not able to find a simple example script where i can see how i have to change this for the Bittrex Authentication
Does anyone have an example Python Code who show's me how this would work for BITTREX (Place Orders or get Balance...)
Thank a lot
Neuri