Advertisement
Guest User

poloniex api query - lua

a guest
May 3rd, 2014
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. require 'crypto'
  2. https = require 'ssl.https'
  3.  
  4. local key, secret = "89QK21JO-8O72SN4U-ZUR4CGE5-TSGNT63S",
  5.                     "50c94254737f8a47364eb6825055fd93c5cf9b2e927d366e7acdf22e58e89e3fa2c32955d1feddc2f395a2d44507c36167be348dbd44b3eae6d1019d938994cd"
  6. local poloniex_url = "https://poloniex.com/tradingApi"
  7. local post_data = "nonce=" .. 1399116375497 .. "&command=returnBalances"--os.time()
  8. local signature = crypto.hmac.digest("sha512", post_data, secret)
  9. print(poloniex_url)
  10. print("sha512:", signature)
  11. https.request
  12. {
  13.   method = "POST",
  14.   url = poloniex_url,
  15.   headers = { Key = key, Sign = signature },
  16.   source = ltn12.source.string(post_data),
  17.   sink = ltn12.sink.file(io.stdout)
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement