Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Node.js code to access trading api
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 ={
url: '',
headers: {
Sign: crypto.createHmac('sha512', secretKey).update(qs.stringify(postData)).digest('hex'),
Key: apiKey
}, function(error, response, body){
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.