-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathtest.mjs
32 lines (26 loc) · 830 Bytes
/
test.mjs
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
/* eslint-disable no-console */
import { BitMexPlus } from '.';
(async function test() {
const bitmex = new BitMexPlus({
// Get your API key at https://www.bitmex.com/app/apiKeys
apiKeyID: '', // REPLACE ME
apiKeySecret: '', // REPLACE ME
});
if (bitmex.options.apiKeyID) {
const pos = (await bitmex.makeRequest('GET', 'position', {
filter: { symbol: 'XBTUSD' },
columns: ['currentQty', 'liquidationPrice'],
}));
console.log(pos);
}
const [bucket] = (await bitmex.makeRequest('GET', 'quote/bucketed', {
binSize: '1m',
symbol: 'XBTUSD',
reverse: true,
count: 1,
columns: ['bidPrice', 'askPrice'],
}));
console.log(bucket);
bitmex.monitorStream('XBTUSD', 'trade', data => console.log(data.price));
setTimeout(() => { process.exit(0); }, 5000);
}());