api_secret = 'some secret'
api_url = 'https://api.bitfinex.com/v1'
def Balances():
nonce = str(long(time.time() * 100000))
payloadObject = {
'request':'/balances',
'nonce': nonce,
'options':{}
}
payload_json = json.dumps(payloadObject)
payload = str(base64.b64encode(payload_json))
parms = urllib.urlencode(payloadObject)
signature = hmac.new(api_secret, parms, hashlib.sha384).hexdigest()
headers = {"X-BFX-APIKEY": api_key,
'X-BFX-PAYLOAD': payload,
"X-BFX-SIGNATURE": signature,
}
public = urllib2.urlopen(urllib2.Request(api_url + '/balances', headers))
balances = json.load(public)
return balances