import requests


def currency_data_last_n_days(currency = 'ETH', to = 'EUR', days = 14):
    """Get day by day price of a currency in respect to another one,
    using the APIs at "min-api.cryptocompare.com".
    Data are from the last "days" days."""

    currencies = 'fsym={0}&tsym={1}'.format(currency, to)
    days = 'limit={0}'.format(days)

    req  = requests.get(  'https://min-api.cryptocompare.com/data/histoday?'
                        + currencies
                        + '&'
                        + days
                        + '&aggregate=1&e=CCCAGG')

    result = req.json()

    return result['Data']