Advertisement
Guest User

updated poloniex api query - lua

a guest
May 4th, 2014
759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 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 =
  16.   {
  17.     Sign = signature,
  18.     Key = key,
  19.     ["Content-Type"] = "application/x-www-form-urlencoded",
  20.     ["Content-Length"] = #post_data
  21.   },
  22.   source = ltn12.source.string(post_data),
  23.   sink = ltn12.sink.file(io.stdout)
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement