GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — api-client-node/client.js at master · BTCMarkets/api-client-node Expand file tree/ Copy pathclient.jsMore file actions 63 lines (53 loc) · 1.54 KB / Copy pathclient.jsFile metadata and controls63 lines (53 loc) · 1.54 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 const crypto = require('crypto'); const https = require('https'); const apiKey = "add api key here"; const privateKey = "add private key here"; const baseUrl = "api.btcmarkets.net"; function postHttp (path, dataObj) { const data = JSON.stringify(dataObj); const now = Date.now(); var message = path + "\n" + now + "\n"; if (data) { message += data; } const signature = signMessage(privateKey, message); let headers = { "Accept": "application/json", "Accept-Charset": "UTF-8", 'Content-Length': Buffer.byteLength(data), "Content-Type": "application/json", }; headers.apikey = apiKey; headers.timestamp = now; headers.signature = signature; var post_options = { host: baseUrl, path: path, method: 'POST', headers: headers }; var post_req = https.request(post_options, function(res) { res.on('data', function (chunk) { console.log('Http Response Code: ' + res.statusCode); console.log('Response: ' + chunk); }); }); post_req.write(data); post_req.end(); }; function signMessage(secret, message) { var key = Buffer.from(secret, 'base64'); var hmac = crypto.createHmac('sha512', key); var signature = hmac.update(message).digest('base64'); return signature; } function getOpenOrdersByMarket() { const data = { currency: 'AUD', instrument: 'XRP', limit: 10 } const path = '/order/open'; postHttp(path, data); } getOpenOrdersByMarket(); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |