Created
April 24, 2019 00:06
-
-
Save icook/02a253e07c9d06d64566f9497e7b643e to your computer and use it in GitHub Desktop.
Working node.js example for the qTrade 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 crypto = require('crypto'); | |
var https = require('https'); | |
var keyID = 170; | |
var secret = ''; | |
var timestamp = Math.floor(Date.now() / 1000); | |
var hash, hmac; | |
var opt = { | |
host: 'api.qtrade.io', | |
path: '/v1/user/me', | |
method: 'GET', | |
}; | |
var text = opt.method + "\n"; | |
text += opt.path + "\n"; | |
text += timestamp + "\n"; | |
text += '' + "\n"; | |
text += secret; | |
hash = crypto.createHash('sha256').update(text, 'utf8').digest().toString('base64') | |
opt.headers = { | |
'Authorization': 'HMAC-SHA256 ' + keyID + ':' + hash, | |
"HMAC-Timestamp": timestamp, | |
} | |
https.request(opt, function(res) { | |
res.setEncoding('utf8'); | |
res.on('data', function (chunk) { | |
console.log('BODY: ' + chunk); | |
}); | |
}).end(); |
any example of PHP implematnation?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello dear plz i need ur help [email protected] plz help me