From 8c9ee64485a94784c8eae8c00d414157733fbdfa Mon Sep 17 00:00:00 2001 From: AuroraTradingTeam Date: Tue, 7 Nov 2017 22:25:31 +0000 Subject: [PATCH] Added back dependency and resolved flake8 errors. --- .travis.yml | 6 +----- libcryptomarket/api/cryptocompare_api.py | 2 +- libcryptomarket/historical.py | 13 ++++--------- requirements_dev.txt | 3 ++- setup.py | 3 ++- tox.ini | 4 +--- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index c63b24d..64a9859 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,7 @@ language: python python: - 3.5 - - 3.4 - - 3.3 - - 2.7 - - 2.6 - + # command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors install: pip install -U tox-travis diff --git a/libcryptomarket/api/cryptocompare_api.py b/libcryptomarket/api/cryptocompare_api.py index 22733cf..295a21a 100644 --- a/libcryptomarket/api/cryptocompare_api.py +++ b/libcryptomarket/api/cryptocompare_api.py @@ -1,6 +1,5 @@ #!/bin/python import requests -import json from datetime import datetime API_URL = "https://min-api.cryptocompare.com/data/" @@ -55,6 +54,7 @@ def get_coinlist(): return requests.get(url).json() + def get_histo(period, fsym, tsym, e, limit=None, toTs=None): """Return historical prices. diff --git a/libcryptomarket/historical.py b/libcryptomarket/historical.py index b45cea4..e2c6e09 100644 --- a/libcryptomarket/historical.py +++ b/libcryptomarket/historical.py @@ -6,6 +6,7 @@ from libcryptomarket.api.cryptocompare_api import ( get_histo, CryptocompareHisto ) + def get_historical_prices(source='cryptocompare', symbol=None, exchange=None, period=None, limit=0, from_time=None, to_time=None): """Get historical prices. @@ -30,9 +31,9 @@ def get_historical_prices(source='cryptocompare', symbol=None, exchange=None, raise ValueError("Input parameter exchange cannot be None.") if ((limit > 0) + - ((from_time is not None) or (to_time is not None)) > 1): - raise ValuError("Only accept input parameter limit, or from_time" - " and to_time pair.") + ((from_time is not None) or (to_time is not None)) > 1): + raise ValueError("Only accept input parameter limit, or from_time" + " and to_time pair.") # Parse from (first 3) and to (last 3) symbol from the parameter # symbol. @@ -69,9 +70,3 @@ def get_historical_prices(source='cryptocompare', symbol=None, exchange=None, return data.sort_values(['r_time']) else: raise ValueError("No source is called {0}".format(source)) - - - - - - diff --git a/requirements_dev.txt b/requirements_dev.txt index 84ff3f6..5c98758 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -10,4 +10,5 @@ Sphinx==1.4.8 pytest==2.9.2 pytest-runner==2.11.1 -pandas>=0.20.0 \ No newline at end of file +pandas>=0.20.0 +requests \ No newline at end of file diff --git a/setup.py b/setup.py index bccf47f..b5c1c5b 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,8 @@ with open('HISTORY.rst') as history_file: history = history_file.read() requirements = [ - 'pandas>=0.20.0' + 'pandas>=0.20.0', + 'requests' ] setup_requirements = [ diff --git a/tox.ini b/tox.ini index 1396193..387386a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,9 @@ [tox] -envlist = py33, py34, py35, flake8 +envlist = py35, flake8 [travis] python = 3.5: py35 - 3.4: py34 - 3.3: py33 [testenv:flake8] basepython=python