PEP8, remove unused imports

This commit is contained in:
enenn 2018-02-04 14:16:11 +01:00
parent 1b57c6e8a5
commit 567f252eae
5 changed files with 14 additions and 18 deletions

View File

@ -1,17 +1,14 @@
# pragma pylint: disable=W0603
""" Cryptocurrency Exchanges support """
import enum
import logging
import ccxt
from random import randint
from typing import List, Dict, Any, Optional
import arrow
import requests
from cachetools import cached, TTLCache
from freqtrade import OperationalException
from freqtrade.exchange.interface import Exchange
logger = logging.getLogger(__name__)

View File

@ -468,7 +468,7 @@ def gen_pair_whitelist(base_currency: str, key: str = 'BaseVolume') -> List[str]
:param key: sort key (defaults to 'BaseVolume')
:return: List of pairs
"""
pairs = sorted(
[s['symbol'] for s in exchange.get_markets() if s['quote'] == base_currency],
reverse=True

View File

@ -412,7 +412,7 @@ def _balance(bot: Bot, update: Update) -> None:
*Balance*: {total}
*Pending*: {used}
*Est. BTC*: {BTCequiv: .8f}
""".format(**balance)
symbol = _CONF['fiat_display_currency']

View File

@ -1,10 +1,9 @@
# pragma pylint: disable=missing-docstring, C0103, bad-continuation, global-statement
# pragma pylint: disable=protected-access
from unittest.mock import Mock, MagicMock, PropertyMock
from unittest.mock import MagicMock, PropertyMock
from random import randint
import logging
import ccxt
from requests.exceptions import RequestException
import pytest
from freqtrade import OperationalException
@ -226,13 +225,13 @@ def test_get_ticker_history(default_conf, mocker):
assert ticks == 123
# change the ticker
#tick = 999
#api_mock.get_ticker_history = MagicMock(return_value=tick)
#mocker.patch('freqtrade.exchange._API', api_mock)
# tick = 999
# api_mock.get_ticker_history = MagicMock(return_value=tick)
# mocker.patch('freqtrade.exchange._API', api_mock)
# ensure caching will still return the original ticker
#ticks = get_ticker_history('ETH/BTC', int(default_conf['ticker_interval']))
#assert ticks == 123
# ticks = get_ticker_history('ETH/BTC', int(default_conf['ticker_interval']))
# assert ticks == 123
def test_cancel_order_dry_run(default_conf, mocker):
@ -280,7 +279,12 @@ def test_get_name(default_conf, mocker):
def test_get_fee(default_conf, mocker):
api_mock = MagicMock()
api_mock.calculate_fee = MagicMock(return_value={'type': 'taker', 'currency': 'BTC', 'rate': 0.025, 'cost': 0.05})
api_mock.calculate_fee = MagicMock(return_value={
'type': 'taker',
'currency': 'BTC',
'rate': 0.025,
'cost': 0.05
})
mocker.patch('freqtrade.exchange._API', api_mock)
assert get_fee() == 0.025

View File

@ -1,7 +1,6 @@
# pragma pylint: disable=missing-docstring, C0103
import copy
import logging
import ccxt
from unittest.mock import MagicMock
import arrow
@ -82,7 +81,6 @@ def test_process_trade_creation(default_conf, ticker, limit_buy_order, health, m
mocker.patch.multiple('freqtrade.main.exchange',
validate_pairs=MagicMock(),
get_ticker=ticker,
#get_wallet_health=health,
buy=MagicMock(return_value='mocked_limit_buy'),
get_order=MagicMock(return_value=limit_buy_order))
init(default_conf, create_engine('sqlite://'))
@ -113,7 +111,6 @@ def test_process_exchange_failures(default_conf, ticker, health, mocker):
mocker.patch.multiple('freqtrade.main.exchange',
validate_pairs=MagicMock(),
get_ticker=ticker,
#get_wallet_health=health,
buy=MagicMock(side_effect=requests.exceptions.RequestException))
init(default_conf, create_engine('sqlite://'))
result = _process(interval=int(default_conf['ticker_interval']))
@ -129,7 +126,6 @@ def test_process_operational_exception(default_conf, ticker, health, mocker):
mocker.patch.multiple('freqtrade.main.exchange',
validate_pairs=MagicMock(),
get_ticker=ticker,
#get_wallet_health=health,
buy=MagicMock(side_effect=OperationalException))
init(default_conf, create_engine('sqlite://'))
assert get_state() == State.RUNNING
@ -147,7 +143,6 @@ def test_process_trade_handling(default_conf, ticker, limit_buy_order, health, m
mocker.patch.multiple('freqtrade.main.exchange',
validate_pairs=MagicMock(),
get_ticker=ticker,
#get_wallet_health=health,
buy=MagicMock(return_value='mocked_limit_buy'),
get_order=MagicMock(return_value=limit_buy_order))
init(default_conf, create_engine('sqlite://'))