Cleanup some code

after deepcode.ai suggestions
This commit is contained in:
Matthias 2019-07-14 20:05:28 +02:00
parent f0206a90b1
commit 4238ee090d
3 changed files with 9 additions and 6 deletions

View File

@ -17,7 +17,7 @@ from freqtrade.state import RunMode
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class DataProvider(object): class DataProvider():
def __init__(self, config: dict, exchange: Exchange) -> None: def __init__(self, config: dict, exchange: Exchange) -> None:
self._config = config self._config = config
@ -81,11 +81,14 @@ class DataProvider(object):
# TODO: Implement me # TODO: Implement me
pass pass
def orderbook(self, pair: str, max: int): def orderbook(self, pair: str, maximum: int):
""" """
return latest orderbook data return latest orderbook data
:param pair: pair to get the data for
:param maximum: Maximum number of orderbook entries to query
:return: dict including bids/asks with a total of `maximum` entries.
""" """
return self._exchange.get_order_book(pair, max) return self._exchange.get_order_book(pair, maximum)
@property @property
def runmode(self) -> RunMode: def runmode(self) -> RunMode:

View File

@ -69,8 +69,8 @@ def test_load_strategy(result):
def test_load_strategy_base64(result): def test_load_strategy_base64(result):
with open("freqtrade/tests/strategy/test_strategy.py", "r") as file: with open("freqtrade/tests/strategy/test_strategy.py", "rb") as file:
encoded_string = urlsafe_b64encode(file.read().encode("utf-8")).decode("utf-8") encoded_string = urlsafe_b64encode(file.read()).decode("utf-8")
resolver = StrategyResolver({'strategy': 'TestStrategy:{}'.format(encoded_string)}) resolver = StrategyResolver({'strategy': 'TestStrategy:{}'.format(encoded_string)})
assert 'adx' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'}) assert 'adx' in resolver.strategy.advise_indicators(result, {'pair': 'ETH/BTC'})

View File

@ -13,4 +13,4 @@ def test_talib_bollingerbands_near_zero_values():
{'close': 0.00000014} {'close': 0.00000014}
]) ])
bollinger = ta.BBANDS(inputs, matype=0, timeperiod=2) bollinger = ta.BBANDS(inputs, matype=0, timeperiod=2)
assert (bollinger['upperband'][3] != bollinger['middleband'][3]) assert bollinger['upperband'][3] != bollinger['middleband'][3]