Skip to content

Commit

Permalink
upd: resolving a typo in a directory name
Browse files Browse the repository at this point in the history
  • Loading branch information
toymak3r committed Nov 19, 2023
1 parent 94148f5 commit f52f3fc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import requests
from coinbase.wallet.client import Client
import json
import locale
locale.setlocale(locale.LC_ALL,'en_GB.UTF-8')
locale.setlocale(locale.LC_ALL, 'en_GB.UTF-8')

from coinbase.wallet.client import Client
import requests

# Function to get cryptocurrency values


def get_cryptocurrency_value(crypto_symbol, currency='usd'):
try:
url = f'https://api.coingecko.com/api/v3/simple/price?ids={crypto_symbol}&vs_currencies={currency}'
Expand All @@ -22,14 +23,16 @@ def get_cryptocurrency_value(crypto_symbol, currency='usd'):
print(f"Error: {e}")
return None


def convert_cryptocurrency(crypto_symbol, amount, currency='usd'):
crypto_value = get_cryptocurrency_value(crypto_symbol, currency)
if crypto_value is not None:
converted_value = amount * crypto_value
return converted_value
else:
return None



class Coinbase:

_client = '' # Coinbase Client Handler
Expand All @@ -51,9 +54,11 @@ def test(self):
accounts = self._client.get_accounts()
for account in accounts["data"]:
if float(account["balance"]["amount"]) != 0.0:
currency = account["currency"]
if currency == 'ETH2':
currency = 'ethereum'
price = convert_cryptocurrency(currency, float(account["balance"]["amount"]), 'gbp')
if price != None:
print(f'{account["currency"]} : {account["balance"]["amount"]} ({locale.currency(price)})')
currency = account["currency"]
if currency == 'ETH2':
currency = 'ethereum'
price = convert_cryptocurrency(
currency, float(account["balance"]["amount"]), 'gbp')
if price != None:
print(
f'{account["currency"]} : {account["balance"]["amount"]} ({locale.currency(price)})')

0 comments on commit f52f3fc

Please sign in to comment.