Javascript

Example Signing Code in Javascript

Signing request param with encrypt(apiSecret, str) function

const crypto = require("crypto")
let api_secret = '...'
let encrypt = (apiSecret, str) => {
let hmac = crypto.createHmac("sha512", apiSecret);
let signed = hmac.update(str).digest('hex');
return signed;
}
let request_header = 'amount='+String(order.amount)+'&nonce='+String(order.nonce)+'&pair='+String(order.pair)+'&price='+String(order.price)+'&side='+String(order.side)+'&type='+String(order.type)
let signed = encrypt(api_secret, request_header)