From f91cd8ea965b4a563e8c4a90d9fa145832f0ac65 Mon Sep 17 00:00:00 2001 From: gcarq Date: Mon, 11 Sep 2017 13:59:38 +0200 Subject: [PATCH] drop support for poloniex --- README.md | 2 +- config.json.example | 6 ------ exchange.py | 45 +++++++------------------------------------ misc.py | 1 - requirements.txt | 1 - test/test_main.py | 6 ------ test/test_telegram.py | 6 ------ 7 files changed, 8 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index 1569eabea..3753a015b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://travis-ci.org/gcarq/freqtrade.svg?branch=develop)](https://travis-ci.org/gcarq/freqtrade) Simple High frequency trading bot for crypto currencies. -Currently supported exchanges: bittrex, poloniex (partly implemented) +Currently supported exchanges: bittrex This software is for educational purposes only. Don't risk money which you are afraid to lose. diff --git a/config.json.example b/config.json.example index 227d4091e..411d2af87 100644 --- a/config.json.example +++ b/config.json.example @@ -9,12 +9,6 @@ "0": 0.02 }, "stoploss": -0.10, - "poloniex": { - "enabled": false, - "key": "key", - "secret": "secret", - "pair_whitelist": [] - }, "bittrex": { "enabled": true, "key": "key", diff --git a/exchange.py b/exchange.py index e92e5cf7e..2b0947311 100644 --- a/exchange.py +++ b/exchange.py @@ -3,7 +3,6 @@ import logging from typing import List from bittrex.bittrex import Bittrex -from poloniex import Poloniex logger = logging.getLogger(__name__) @@ -14,7 +13,6 @@ _CONF = {} class Exchange(enum.Enum): - POLONIEX = 0 BITTREX = 1 @@ -33,13 +31,8 @@ def init(config: dict) -> None: if config['dry_run']: logger.info('Instance is running with dry_run enabled') - use_poloniex = config.get('poloniex', {}).get('enabled', False) use_bittrex = config.get('bittrex', {}).get('enabled', False) - - if use_poloniex: - EXCHANGE = Exchange.POLONIEX - _API = Poloniex(key=config['poloniex']['key'], secret=config['poloniex']['secret']) - elif use_bittrex: + if use_bittrex: EXCHANGE = Exchange.BITTREX _API = Bittrex(api_key=config['bittrex']['key'], api_secret=config['bittrex']['secret']) else: @@ -47,9 +40,10 @@ def init(config: dict) -> None: # Check if all pairs are available markets = get_markets() - for pair in config[EXCHANGE.name.lower()]['pair_whitelist']: + exchange_name = EXCHANGE.name.lower() + for pair in config[exchange_name]['pair_whitelist']: if pair not in markets: - raise RuntimeError('Pair {} is not available at Poloniex'.format(pair)) + raise RuntimeError('Pair {} is not available at {}'.format(pair, exchange_name)) def buy(pair: str, rate: float, amount: float) -> str: @@ -62,9 +56,6 @@ def buy(pair: str, rate: float, amount: float) -> str: """ if _CONF['dry_run']: return 'dry_run' - elif EXCHANGE == Exchange.POLONIEX: - _API.buy(pair, rate, amount) - # TODO: return order id elif EXCHANGE == Exchange.BITTREX: data = _API.buy_limit(pair.replace('_', '-'), amount, rate) if not data['success']: @@ -82,9 +73,6 @@ def sell(pair: str, rate: float, amount: float) -> str: """ if _CONF['dry_run']: return 'dry_run' - elif EXCHANGE == Exchange.POLONIEX: - _API.sell(pair, rate, amount) - # TODO: return order id elif EXCHANGE == Exchange.BITTREX: data = _API.sell_limit(pair.replace('_', '-'), amount, rate) if not data['success']: @@ -100,9 +88,6 @@ def get_balance(currency: str) -> float: """ if _CONF['dry_run']: return 999.9 - elif EXCHANGE == Exchange.POLONIEX: - data = _API.returnBalances() - return float(data[currency]) elif EXCHANGE == Exchange.BITTREX: data = _API.get_balance(currency) if not data['success']: @@ -116,14 +101,7 @@ def get_ticker(pair: str) -> dict: :param pair: Pair as str, format: BTC_ETC :return: dict """ - if EXCHANGE == Exchange.POLONIEX: - data = _API.returnTicker() - return { - 'bid': float(data[pair]['highestBid']), - 'ask': float(data[pair]['lowestAsk']), - 'last': float(data[pair]['last']) - } - elif EXCHANGE == Exchange.BITTREX: + if EXCHANGE == Exchange.BITTREX: data = _API.get_ticker(pair.replace('_', '-')) if not data['success']: raise RuntimeError('BITTREX: {}'.format(data['message'])) @@ -142,8 +120,6 @@ def cancel_order(order_id: str) -> None: """ if _CONF['dry_run']: pass - elif EXCHANGE == Exchange.POLONIEX: - raise NotImplemented('Not implemented') elif EXCHANGE == Exchange.BITTREX: data = _API.cancel(order_id) if not data['success']: @@ -158,8 +134,6 @@ def get_open_orders(pair: str) -> List[dict]: """ if _CONF['dry_run']: return [] - elif EXCHANGE == Exchange.POLONIEX: - raise NotImplemented('Not implemented') elif EXCHANGE == Exchange.BITTREX: data = _API.get_open_orders(pair.replace('_', '-')) if not data['success']: @@ -180,9 +154,7 @@ def get_pair_detail_url(pair: str) -> str: :param pair: pair as str, format: BTC_ANT :return: url as str """ - if EXCHANGE == Exchange.POLONIEX: - raise NotImplemented('Not implemented') - elif EXCHANGE == Exchange.BITTREX: + if EXCHANGE == Exchange.BITTREX: return 'https://bittrex.com/Market/Index?MarketName={}'.format(pair.replace('_', '-')) @@ -191,10 +163,7 @@ def get_markets() -> List[str]: Returns all available markets :return: list of all available pairs """ - if EXCHANGE == Exchange.POLONIEX: - # TODO: implement - raise NotImplemented('Not implemented') - elif EXCHANGE == Exchange. BITTREX: + if EXCHANGE == Exchange. BITTREX: data = _API.get_markets() if not data['success']: raise RuntimeError('BITTREX: {}'.format(data['message'])) diff --git a/misc.py b/misc.py index 2d653651d..668770f7d 100644 --- a/misc.py +++ b/misc.py @@ -78,7 +78,6 @@ CONF_SCHEMA = { } }, 'anyOf': [ - {'required': ['poloniex']}, {'required': ['bittrex']} ], 'required': [ diff --git a/requirements.txt b/requirements.txt index 7ee7236ee..df6e07226 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ --e git+https://github.com/s4w3d0ff/python-poloniex.git#egg=Poloniex -e git+https://github.com/ericsomdahl/python-bittrex.git#egg=python-bittrex SQLAlchemy==1.1.13 python-telegram-bot==7.0.1 diff --git a/test/test_main.py b/test/test_main.py index bd9bb0c47..e4ee83de3 100644 --- a/test/test_main.py +++ b/test/test_main.py @@ -20,12 +20,6 @@ class TestMain(unittest.TestCase): "720": 0.01, "0": 0.02 }, - "poloniex": { - "enabled": False, - "key": "key", - "secret": "secret", - "pair_whitelist": [] - }, "bittrex": { "enabled": True, "key": "key", diff --git a/test/test_telegram.py b/test/test_telegram.py index 55b9c73f2..906df8e87 100644 --- a/test/test_telegram.py +++ b/test/test_telegram.py @@ -28,12 +28,6 @@ class TestTelegram(unittest.TestCase): "720": 0.01, "0": 0.02 }, - "poloniex": { - "enabled": False, - "key": "key", - "secret": "secret", - "pair_whitelist": [] - }, "bittrex": { "enabled": True, "key": "key",