Created
October 25, 2019 01:32
-
-
Save thomasdavis/a14fe8821185d6d2bf60a4dee818f891 to your computer and use it in GitHub Desktop.
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
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