-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
looping over all symbols of specific exchanges
github-actions[bot] edited this page Jun 11, 2026
·
2 revisions
import ccxt from '../../js/ccxt.js';
import asTable from 'as-table';
import ansicolor from 'ansicolor';
import ololog from 'ololog';
const log = ololog.configure ({ locate: false }), verbose = process.argv.includes ('--verbose');
ansicolor.nice
//-----------------------------------------------------------------------------
;(async () => {
const exchanges = [ 'bittrex', 'poloniex', 'hitbtc2' ]
for (let exchangeId of exchanges) {
// create the exchange instance
const exchange = new ccxt[exchangeId] ()
// preload all markets first, as explained in the Manual:
// https://github.com/ccxt/ccxt/wiki/Manual#loading-markets
// add error/exception handling as required by the Manual:
// https://github.com/ccxt/ccxt/wiki/Manual#error-handling
try {
await exchange.loadMarkets ();
} catch (e) {
log.red ('Could not load markets from', exchange.id + ':', e.constructor.name, e.message)
continue; // skip this exchange if markets failed to load
}
for (let symbol in exchange.markets) {
console.log (exchange.id, symbol)
// add error/exception handling as required by the Manual:
// https://github.com/ccxt/ccxt/wiki/Manual#error-handling
try { // try fetching the ticker for a symbol existing with that exchange
const ticker = await exchange.fetchTicker (symbol)
log.green (ticker)
} catch (e) { // catch the error (if any) and handle it or ignore it
log.red ('Could not fetch', symbol, 'ticker from', exchange.id + ':', e.constructor.name, e.message)
}
}
}
}) ()(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
- Install
- Examples
- Manual
- CCXT Pro
- Contributing
- Supported Exchanges
- Exchanges By Country
- API Spec By Method
- FAQ
- Changelog
- Awesome
- API Spec by Exchange
- fetchCurrencies
- alpaca
- apex
- ascendex
- aster
- backpack
- bigone
- binance
- bingx
- bit2c
- bitbank
- bitbns
- bitfinex
- bitflyer
- bitget
- bithumb
- bitmart
- bitmex
- bitopro
- bitrue
- bitso
- bitstamp
- bitteam
- bittrade
- bitvavo
- blockchaincom
- blofin
- btcbox
- btcmarkets
- btcturk
- bullish
- bybit
- bydfi
- cex
- coinbase
- coinbaseexchange
- coinbaseinternational
- coincheck
- coinex
- coinmate
- coinmetro
- coinone
- coinsph
- coinspot
- cryptocom
- cryptomus
- deepcoin
- delta
- deribit
- derive
- digifinex
- dydx
- exmo
- extended
- foxbit
- gate
- gemini
- grvt
- hashkey
- hibachi
- hitbtc
- hollaex
- htx
- hyperliquid
- independentreserve
- indodax
- kraken
- krakenfutures
- kucoin
- fetchBidsAsks
- latoken
- lbank
- lighter
- luno
- mercado
- mexc
- modetrade
- ndax
- novadax
- okx
- onetrading
- p2b
- pacifica
- paradex
- paymium
- phemex
- poloniex
- tokocrypto
- toobit
- upbit
- weex
- whitebit
- woo
- woofipro
- xt
- zaif
- fetchStatus