Created
June 7, 2018 15:12
-
-
Save dmig/0a9ef224561b515f44d4710cc82863d1 to your computer and use it in GitHub Desktop.
Coin collision search tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! venv/bin/python3 | |
import ccxt | |
for cls in ccxt.exchanges: | |
Exch = ccxt.__dict__[cls]({'timeout': 20000}) | |
if not Exch.has['publicAPI']: | |
print('# %s: only private API, skipped' % (cls,)) | |
continue | |
if not Exch.has['fetchCurrencies']: | |
print('# %s: doesn\'t support fetchCurrencies, skipped' % (cls,)) | |
continue | |
try: | |
res = Exch.fetchCurrencies() | |
for symb in res: | |
print('%s\t%s\t%s' % (symb, res[symb]['name'], cls)) | |
except ccxt.errors.DDoSProtection: | |
print('# %s: hit by DDoS protection, skipped' % (cls,)) | |
continue | |
except ccxt.errors.RequestTimeout: | |
print('# %s: request timeout, skipped' % (cls,)) | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! venv/bin/python3 | |
import sys | |
from difflib import SequenceMatcher as sema | |
symbol = None | |
names = {} | |
with open(sys.argv[1], encoding='utf-8') as f: | |
for line in f.readlines(): | |
if not line or line[0] == '#': | |
continue | |
line = line.strip().split('\t') | |
if symbol != line[0]: | |
if names: | |
for n in names: | |
names[n].sort() | |
print('%s\t%s\t%s' % (symbol, n, ', '.join(names[n]))) | |
symbol = line[0] | |
names = {} | |
found = None | |
cn = line[1].lower() | |
for n in names: | |
if sema(lambda x: x == ' ', cn, n.lower()).ratio() > 0.7: | |
found = n | |
break | |
if not found: | |
found = line[1] | |
if found not in names: | |
names[found] = [] | |
names[found].append(line[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! venv/bin/python3 | |
import re | |
import requests | |
line_matcher = re.compile( | |
"<tr>\s*<td class='first' data-sort='(\d+)'>(.+?)</td>\s*<td>(.+?)</td>.+?</tr>", | |
re.DOTALL | |
) | |
r = requests.get( | |
'https://yobit.net/en/coinsinfo/', headers={'Referrer': 'https://yobit.net/en/coinsinfo/'} | |
) | |
for res in line_matcher.finditer(r.text): | |
print('%s\t%s\tyobit' % (res[2], res[3])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment