Last active
July 11, 2018 02:45
-
-
Save jean-airoldie/c0467a630425583bf80aa468be8eb89b to your computer and use it in GitHub Desktop.
fuck you
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
import requests | |
r = requests.get('https://api.bitfinex.com/v1/symbols_details') | |
json_bitfinex = r.json() | |
r = requests.get('https://api.coinmarketcap.com/v2/listings/') | |
json_coinmarketcap = r.json() | |
symbols = set() | |
for currency in json_bitfinex: | |
symbols.add(currency["pair"][0:3]) | |
symbols.add(currency["pair"][3:]) | |
symbol_map = dict() | |
for symbol in symbols: | |
counter = 0 | |
names = [] | |
for currency in json_coinmarketcap["data"]: | |
if currency["symbol"].upper() == symbol.upper(): | |
names.append(currency["website_slug"]) | |
counter += 1 | |
if not counter: | |
print("No match for {}".format(symbol.upper())) | |
elif counter == 1: | |
symbol_map[symbol.upper()] = names[0] | |
else: | |
print("Duplicate for {}".format(symbol.upper())) | |
print(symbol_map) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment