Skip to content

Instantly share code, notes, and snippets.

@thomasdavis
Created October 25, 2019 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasdavis/a14fe8821185d6d2bf60a4dee818f891 to your computer and use it in GitHub Desktop.
Save thomasdavis/a14fe8821185d6d2bf60a4dee818f891 to your computer and use it in GitHub Desktop.
const key = "zzz";
const secret = "aaa";
const payload = {
orders: [
{ volume: "0.000001", orderType: "limit", price: "0.000001", side: "buy" }
],
market: "btctusd"
};
const nonce = new Date().getTime() + "";
const rawSignature = btoa(key) + btoa(nonce) + btoa(JSON.stringify(payload));
const hmac = crypto.createHmac("sha384", secret);
hmac.update(rawSignature);
const hmacSignature = hmac.digest("base64");
const res = axios({
url: `${hostname}/trades/my?market=btcusdt`,
headers: {
"X-Blockbid-Signature": hmacSignature,
"X-Blockbid-Nonce": nonce,
"X-Blockbid-Api-Key": key
},
method: "GET"
}).then(res => {
console.log(res.data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment