mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-09 16:28:06 +00:00
26 lines
514 B
Markdown
26 lines
514 B
Markdown
- [Fetch From Many Exchanges Simultaneously](./examples/js/)
|
|
|
|
|
|
```javascript
|
|
|
|
|
|
import ccxt from '../../js/ccxt.js';
|
|
import log from 'ololog';
|
|
|
|
const symbol = 'ETH/BTC'
|
|
const exchanges = [ 'coinbasepro', 'hitbtc2', 'poloniex' ]
|
|
|
|
;(async () => {
|
|
|
|
const result = await Promise.all (exchanges.map (async id => {
|
|
|
|
const exchange = new ccxt[id] ()
|
|
const ticker = await exchange.fetchTicker (symbol)
|
|
return exchange.extend ({ 'exchange': id }, ticker)
|
|
|
|
}))
|
|
|
|
log (result);
|
|
|
|
}) ()
|
|
``` |