Skip to content

Instantly share code, notes, and snippets.

@cryptoeraser
Last active December 29, 2018 16:18
Show Gist options
  • Save cryptoeraser/37e62c8ac8c21a588638a11b54d5e10a to your computer and use it in GitHub Desktop.
Save cryptoeraser/37e62c8ac8c21a588638a11b54d5e10a to your computer and use it in GitHub Desktop.
Improved and more advanced version of the initial filter_ticker. Credit goes to @m59.
/*
https://vcdepth.io DOM Filtering Script
Author: @m59
Community: Bitcoin Trading Challenge
Notes: Improved and optimised version by @m59.
*/
const pairs = ['EOS', 'XMR', 'ZEC']
const zip = ([ a, b ]) => a.map((v, index) => [ v, b[index] ])
Array.prototype.flat = function () { return this.reduce((acc, v) => acc.concat(v), []) }
zip([ ...document.querySelectorAll('.dataTable tbody') ].map(node => [ ...node.children ]))
.map(rowElements => ({ ticker: rowElements[0].querySelector('a:last-child').textContent, rowElements }))
.filter(({ ticker }) => !pairs.includes(ticker))
.map(({ rowElements }) => rowElements)
.flat()
.forEach(element => element.remove())
@cryptoeraser
Copy link
Author

My pairs are:

const pairs = ['ANT', 'ARK', 'BAT', 'BLT', 'BURST', 'DASH', 'DNT', 'DYN', 'ENG', 'ETC', 'ETH', 'FCT', 'GEO', 'GNO', 'LRC', 'LSK', 'LTC', 'MFT', 'NMR', 'NPXS', 'OCN', 'OMG', 'OMNI', 'PAY', 'POLY', 'QTUM', 'QWARK', 'REP', 'RVN', 'SC', 'STRAT', 'STEEM', 'TRX', 'UBQ', 'WAVES', 'XCP', 'XLM', 'ZEC', 'ZRX']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment