{
const ALL_CURRENCIES = [
'btc', 'link', 'linch', 'usd', 'eur', 'gbp', 'pax', 'xrp', 'eth',
'ltc', 'bch', 'xlm', 'omg', 'bat', 'aave', 'uma', 'eth2',
'mkr', 'knc', 'algo', 'audio', 'crv', 'snx', 'dai', 'yfi',
'uni', 'comp', 'grt', 'eurt', 'mana', 'usdc', 'zrx', 'lrc',
'mati', 'usdt', 'enj', 'chz', 'hba', 'sand', 'storj', 'ada',
'matic', 'sushi', 'hbar', 'fet', 'skl', 'sxp', 'slp', 'sgb',
'alpha', 'ftm', 'dydx', 'gala', 'ens', 'perp', 'cvx', 'imx',
'axs', 'amp', 'shib', 'avax', 'nex', 'ant', 'rad', 'band', 'gods',
'ctsi', 'rly', 'inj', 'rndr', 'sol', 'ape', 'dot', 'near',
'nexo', 'vega', 'mpl'
];
const currencyPairRegex = (function(allCurrencies) {
const pipedCurrencies = allCurrencies.join('|')
return new RegExp(`(?<from>${pipedCurrencies})(?<to>${pipedCurrencies})`);
})(ALL_CURRENCIES);
fetch('https://www.bitstamp.net/api/v2/trading-pairs-info/')
.then(res => res.json())
.then(data => data.map(el => el.url_symbol))
.then(symbols => symbols.map(str => ({
str, match: str.match(currencyPairRegex) !== null
})).filter(({match}) => !match))
.then(data => console.log({data}))
}