Created
March 24, 2017 19:49
-
-
Save levity/68184191145e1fcc8b4b13a3931a063f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 request = require('request') | |
const crypto = require('crypto') | |
const url = 'https://api.bitfinex.com/v1' | |
const apiKey = '<Your API key here>' | |
const apiSecret = '<Your API secret here>' | |
const payload = { | |
'request': '/v1/account_infos', | |
'nonce': Date.now().toString() | |
} | |
const body = new Buffer(JSON.stringify(payload)) | |
.toString('base64') | |
const signature = crypto | |
.createHmac('sha384', apiSecret) | |
.update(body) | |
.digest('hex') | |
const headers = { | |
'X-BFX-APIKEY': apiKey, | |
'X-BFX-PAYLOAD': body, | |
'X-BFX-SIGNATURE': signature | |
} | |
const options = { | |
url: `${url}/account_infos`, | |
headers, | |
body | |
} | |
request.post(options, (error, response, body) => console.log(body)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment