1 | "use strict"; |
||
2 | |||
3 | const ccxt = require ('../../ccxt-es5.js') |
||
4 | const countries = require ('../../countries.js') |
||
5 | const asTable = require ('as-table') |
||
6 | const util = require ('util') |
||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||
7 | const log = require ('ololog').configure ({ locate: false }) |
||
8 | |||
9 | require ('ansicolor').nice; |
||
0 ignored issues
–
show
|
|||
10 | |||
11 | process.on ('uncaughtException', e => { log.bright.red.error (e); process.exit (1) }) |
||
0 ignored issues
–
show
Compatibility
Debugging Code
Best Practice
introduced
by
|
|||
12 | process.on ('unhandledRejection', e => { log.bright.red.error (e); process.exit (1) }) |
||
0 ignored issues
–
show
Compatibility
Debugging Code
Best Practice
introduced
by
|
|||
13 | |||
14 | let exchanges = {} |
||
15 | |||
16 | ccxt.exchanges.forEach (id => { exchanges[id] = new (ccxt)[id] () }) |
||
17 | |||
18 | log ('The ccxt library supports', (ccxt.exchanges.length.toString ()).green, 'exchanges:') |
||
19 | |||
20 | var countryName = function (code) { |
||
21 | return ((typeof countries[code] !== 'undefined') ? countries[code] : code) |
||
22 | } |
||
23 | |||
24 | log (asTable.configure ({ delimiter: ' | ' }) (Object.values (exchanges).map (exchange => { |
||
25 | |||
26 | let countries = Array.isArray (exchange.countries) ? |
||
27 | exchange.countries.map (countryName).join (', ') : |
||
28 | countryName (exchange.countries) |
||
29 | |||
30 | let website = Array.isArray (exchange.urls.www) ? exchange.urls.www[0] : exchange.urls.www |
||
31 | |||
32 | return { |
||
33 | id: exchange.id, |
||
34 | name: exchange.name, |
||
35 | url: website, |
||
36 | countries: countries, |
||
37 | } |
||
38 | |||
39 | }))) |