def get_onchain_exchange_rates(deposit_crypto=None, withdraw_crypto=None, **modes):
from moneywagon.onchain_exchange import ALL_SERVICES<EOL>rates = []<EOL>for Service in ALL_SERVICES:<EOL><INDENT>srv = Service(verbose=modes.get('<STR_LIT>', False))<EOL>rates.extend(srv.onchain_exchange_rates())<EOL><DEDENT>if deposit_crypto:<EOL><INDENT>rates = [x for x in rates if x['<STR_LIT>']['<STR_LIT:code>'] == deposit_crypto.upper()]<EOL><DEDENT>if withdraw_crypto:<EOL><INDENT>rates = [x for x in rates if x['<STR_LIT>']['<STR_LIT:code>'] == withdraw_crypto.upper()]<EOL><DEDENT>if modes.get('<STR_LIT>', False):<EOL><INDENT>return max(rates, key=lambda x: float(x['<STR_LIT>']))<EOL><DEDENT>return rates<EOL>
Gets exchange rates for all defined on-chain exchange services.