Skip to content

Instantly share code, notes, and snippets.

@Endogen
Last active August 10, 2017 23:01
Show Gist options
  • Save Endogen/a98cc2b8f72544b1554ae6379b3aba22 to your computer and use it in GitHub Desktop.
Save Endogen/a98cc2b8f72544b1554ae6379b3aba22 to your computer and use it in GitHub Desktop.
Get all tradable asset pairs, extract the coin name and create a button for each of them
# Send request to Kraken to get all tradable asset pairs
res_data = kraken.query_public("AssetPairs")
# If Kraken replied with an error, show it
if res_data["error"]:
update.message.reply_text(beautify(res_data["error"][0]))
return
currencies = list()
# Go over all pairs and filter out all tradable currencies
for pair, data in res_data["result"].items():
currencies.append(data["base"])
buttons = list()
# Create a button for every currency
for currency in set(currencies):
buttons.append(KeyboardButton(currency))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment