We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 58dc519 commit 53dc414Copy full SHA for 53dc414
1 file changed
plugins/cryptocurrency.py
@@ -18,6 +18,12 @@
18
19
API_URL = "https://api.coinmarketcap.com/v1/ticker/{}"
20
21
+CURRENCY_SYMBOLS = {
22
+ 'USD': '$',
23
+ 'GBP': '£',
24
+ 'EUR': '€',
25
+}
26
+
27
28
def get_request(ticker, currency):
29
return requests.get(API_URL.format(quote_plus(ticker)), params={'convert': currency})
@@ -84,14 +90,7 @@ def crypto_command(text):
84
90
else:
85
91
change_str = "{}%".format(change)
86
92
87
- if currency == 'GBP':
88
- currency_sign = '£'
89
- elif currency == 'EUR':
- currency_sign = '€'
- elif currency == 'USD':
- currency_sign = '$'
93
- else:
94
- currency_sign = ''
+ currency_sign = CURRENCY_SYMBOLS.get(currency, '')
95
96
try:
97
converted_value = data['price_' + currency.lower()]
0 commit comments