<commit_before>from . import poloniex, btc_e, bittrex, bitfinex
from ccas.models import database

def get_balances(exchange, public_key, secret_key):
    if exchange == "poloniex":
        return poloniex.get_balances(public_key, secret_key)
    if exchange == "btc-e":
        return btc_e.get_balances(public_key, secret_key)
    if exchange == "bittrex":
        return bittrex.get_balances(public_key, secret_key)
    if exchange == "bitfinex":
        return bitfinex.get_balances(public_key, secret_key)

def get_exchanges():
    response = database.new_query("SELECT id, exchange FROM exchanges_api_keys;")
    return list(response)

def get_btc_price():
    exchange = database.new_query("SELECT value FROM settings WHERE name='btc_exchange';")
    if exchange[0][0] == "btc-e":
        btc_price = btc_e.get_btc_price()
    return round(btc_price,2)<commit_msg>Added global get_price(currency)<commit_after>from . import poloniex, btc_e, bittrex, bitfinex
from ccas.models import database

def get_balances(exchange, public_key, secret_key):
    if exchange == "poloniex":
        return poloniex.get_balances(public_key, secret_key)
    if exchange == "btc-e":
        return btc_e.get_balances(public_key, secret_key)
    if exchange == "bittrex":
        return bittrex.get_balances(public_key, secret_key)
    if exchange == "bitfinex":
        return bitfinex.get_balances(public_key, secret_key)

def get_exchanges():
    response = database.new_query("SELECT id, exchange FROM exchanges_api_keys;")
    return list(response)

def get_btc_price():
    exchange = database.new_query("SELECT value FROM settings WHERE name='exchange_price_btc';")
    if exchange[0][0] == "btc-e":
        btc_price = btc_e.get_btc_price()
    return round(btc_price,2)


def get_price(currency):
    exchange = database.new_query("SELECT `value` FROM `settings` WHERE `name`='exchange_price_"+ currency.lower() +"';")[0][0]
    if exchange == "poloniex":
        return poloniex.get_price(currency)
    if exchange == "btc-e":
        return btc_e.get_price(currency)
    if exchange == "bittrex":
        return bittrex.get_price(currency)
    if exchange == "bitfinex":
        return bitfinex.get_price(currency)
    return 0
{'fraction_non_alphanumeric': 0.11280898876404494, 'fraction_numerical': 0.004044943820224719, 'mean_word_length': 4.176744186046512, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '501539', 'n_tokens_mistral': 767, 'n_tokens_neox': 747, 'n_words': 162}