INNER CODE UNIT · Python
get_balance
liamhartley/cryptotradingbot · trading_strategies/coinbase_cmo_trading_strategy/app/app.py:10
def get_balance(coinbase_wrapper, ticker: str):
'''
Function to parse the get_accounts output to find the balance for a given ticker
:param ticker: the ticker for the cryptocurrency that you want the balnace for e.g. BTC
:return:
'''
all_accounts = coinbase_wrapper.get_accounts()
response = None
for account in all_accounts:
if account['currency'] == ticker:
response = account
assert response is not None
return response