Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. def createSignString(params):
  2.     for (i, p) in enumerate(params):
  3.         params[i] = p.upper()
  4.     params = sorted(params)
  5.     sign = ""
  6.     for p in params:
  7.         sign += p + "&"
  8.     sign = sign[:-1]
  9.     m = hashlib.md5()
  10.     m.update(sign.encode('utf-8'))
  11.     return m.hexdigest()
  12.  
  13. def placeOrder(apiid, price, quantity, symbol, ptype, timestamp, sign):
  14.     r = requests.post('http://api.coinbene.com/v1/trade/order/place',
  15.         data = {'apiid' : apiid,  'price' : price, 'quantity' : quantity,
  16.                 'symbol' : symbol, 'type' : ptype, 'timestamp' : timestamp, 'sign' : sign })
  17.     print(r.text)
  18.  
  19. ts = int(round(time.time() * 1000))
  20. tsstring = 'timestamp=' + str(ts)
  21. apiidstr = 'apiid=' + str(180220233838457665082)
  22. placeOrder(180220233838457665082, '0.000001', 1, 'PLAYETH', 'buy-limit', ts,
  23.             createSignString(['symbol=playeth', 'price=0.000001', 'quantity=1', 'type=buy-limit',
  24.             tsstring, apiidstr, 'secret=LOLNO']))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement