Created
June 27, 2014 03:37
-
-
Save magician11/31b0d48f3d17b56af999 to your computer and use it in GitHub Desktop.
Node.js code to access bitcoin.co.id trading api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var qs = require('querystring'); | |
var crypto = require('crypto'); | |
var secretKey = "my secret key"; | |
var apiKey = 'public API key'; | |
var postData = { | |
method: 'getInfo', | |
nonce: new Date().getTime() | |
}; | |
console.log("params: " + qs.stringify(postData)); | |
console.log("Sign: " + crypto.createHmac('sha512', secretKey).update(qs.stringify(postData)).digest('hex')); | |
console.log("API key: " + apiKey); | |
var req = request.post({ | |
url: 'https://vip.bitcoin.co.id/tapi', | |
headers: { | |
Sign: crypto.createHmac('sha512', secretKey).update(qs.stringify(postData)).digest('hex'), | |
Key: apiKey | |
} | |
}, function(error, response, body){ | |
console.log(body); | |
}); | |
console.log(req); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment