-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitfinex-fetch-trades.js
34 lines (24 loc) · 1008 Bytes
/
bitfinex-fetch-trades.js
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
"use strict";
// ----------------------------------------------------------------------------
const ccxt = require ('../../ccxt.js')
, log = require ('ololog')
, asTable = require ('as-table').configure ({ delimiter: ' | ' })
// ----------------------------------------------------------------------------
;(async () => {
const exchange = new ccxt.bitfinex ({
'verbose': process.argv.includes ('--verbose'),
'timeout': 60000,
})
try {
const response = await exchange.fetchTrades ('ETH/BTC', 1518983548636 - 2 * 24 * 60 * 60 * 1000)
log (asTable (response))
log (response.length.toString (), 'trades')
log.green ('Succeeded.')
} catch (e) {
log.dim ('--------------------------------------------------------')
log (e.constructor.name, e.message)
log.dim ('--------------------------------------------------------')
log.dim (exchange.last_http_response)
log.error ('Failed.')
}
}) ()