diff --git a/libcryptomarket/cli/candles.py b/libcryptomarket/cli/candles.py index 7b50ae9..bfb2ae4 100644 --- a/libcryptomarket/cli/candles.py +++ b/libcryptomarket/cli/candles.py @@ -3,7 +3,7 @@ import logging import pandas as pd -from libcryptomarket.core import candles, FREQUENCY_TO_SEC_DICT +from libcryptomarket import * LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' @@ -51,13 +51,15 @@ def main(): all_data = {} + exchange = globals()[args.exchange.lower()] + for symbol in args.symbols: logging.info('Querying symbol %s...', symbol) - data = candles(source=args.exchange, - symbol=symbol, - start_time=start_time, - end_time=end_time, - frequency=args.frequency) + data = exchange().fetch_candles( + symbol=symbol, + start_time=start_time, + end_time=end_time, + frequency=args.frequency) all_data[symbol] = data.set_index(['start_time'], ['end_time']) logging.info('Cleaning the data...') diff --git a/notebooks/Candles.ipynb b/notebooks/Candles.ipynb index 67782c5..84989ec 100644 --- a/notebooks/Candles.ipynb +++ b/notebooks/Candles.ipynb @@ -5,8 +5,8 @@ "execution_count": 1, "metadata": { "ExecuteTime": { - "end_time": "2018-02-25T15:25:54.826490Z", - "start_time": "2018-02-25T15:25:54.202778Z" + "end_time": "2018-03-02T13:59:06.716302Z", + "start_time": "2018-03-02T13:59:06.040476Z" } }, "outputs": [], @@ -29,11 +29,11 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 2, "metadata": { "ExecuteTime": { - "end_time": "2018-02-27T14:08:40.924686Z", - "start_time": "2018-02-27T14:08:32.436437Z" + "end_time": "2018-03-02T13:59:16.182130Z", + "start_time": "2018-03-02T13:59:06.746957Z" }, "scrolled": true }, @@ -42,9 +42,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "Running exchange for instrument LTC/BTC\n", - "Running exchange for instrument BTC/USD\n", - "Running exchange for instrument BTC/USD\n" + "Running exchange for instrument LTC/BTC\n", + "Running exchange for instrument BTC/USD\n", + "Running exchange for instrument BTC/USD\n" ] } ], @@ -71,24 +71,9 @@ }, { "cell_type": "code", - "execution_count": 20, - "metadata": { - "ExecuteTime": { - "end_time": "2018-02-27T14:12:49.988940Z", - "start_time": "2018-02-27T14:12:33.771357Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Running exchange for instrument ['LTC/BTC', 'ETH/BTC']\n", - "Running exchange for instrument ['BTC/USD', 'ETH/USD']\n", - "Running exchange for instrument ['BTC/USD', 'ETH/USD']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import libcryptomarket\n", "\n", @@ -111,22 +96,9 @@ }, { "cell_type": "code", - "execution_count": 27, - "metadata": { - "ExecuteTime": { - "end_time": "2018-02-27T14:16:10.738926Z", - "start_time": "2018-02-27T14:16:06.651033Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Running exchange for instrument ['BTC/USDT']\n" - ] - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "import libcryptomarket\n", "\n", diff --git a/setup.py b/setup.py index 89e102a..e57cd91 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ with open('HISTORY.rst') as history_file: requirements = [ 'ccxt==1.10.1198', 'pandas>=0.20.0', - 'requests==2.11.0', + 'requests[security]', 'setuptools_scm', ]