Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import datetime
import hashlib
import hmac
import random
import string
import time
import unirest as unirest
key = "da01c7e1f0dc4f166c6aa3d56add3293"
nonce = str(int(time.mktime( * 1000 + / 1000))
clientOrderId = "".join(random.choice(string.digits + string.ascii_lowercase) for _ in range(30))
path = "/api/1/trading/new_order?apikey=" + key + "&nonce=" + nonce
newOrder = "clientOrderId=" + clientOrderId + "&symbol=BTCUSD&side=buy&price=250&quantity=100&type=limit"
signature =, path + newOrder, hashlib.sha512).hexdigest()
result ="" + path, headers={"Api-Signature": signature}, params=newOrder)
print result.body['ExecutionReport']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.