2018-01-15 08:35:11 +00:00
|
|
|
from pandas import DataFrame
|
2018-03-17 21:44:47 +00:00
|
|
|
|
2020-02-18 19:12:10 +00:00
|
|
|
from .strats.default_strategy import DefaultStrategy
|
2018-01-15 08:35:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_default_strategy_structure():
|
|
|
|
assert hasattr(DefaultStrategy, 'minimal_roi')
|
|
|
|
assert hasattr(DefaultStrategy, 'stoploss')
|
2018-01-20 22:40:41 +00:00
|
|
|
assert hasattr(DefaultStrategy, 'ticker_interval')
|
2018-01-15 08:35:11 +00:00
|
|
|
assert hasattr(DefaultStrategy, 'populate_indicators')
|
|
|
|
assert hasattr(DefaultStrategy, 'populate_buy_trend')
|
|
|
|
assert hasattr(DefaultStrategy, 'populate_sell_trend')
|
|
|
|
|
2018-01-18 05:50:12 +00:00
|
|
|
|
2018-01-15 08:35:11 +00:00
|
|
|
def test_default_strategy(result):
|
2018-07-16 05:11:17 +00:00
|
|
|
strategy = DefaultStrategy({})
|
2018-01-15 08:35:11 +00:00
|
|
|
|
2018-07-29 19:07:21 +00:00
|
|
|
metadata = {'pair': 'ETH/BTC'}
|
2018-01-15 08:35:11 +00:00
|
|
|
assert type(strategy.minimal_roi) is dict
|
|
|
|
assert type(strategy.stoploss) is float
|
2020-06-02 07:36:04 +00:00
|
|
|
assert type(strategy.timeframe) is str
|
2018-07-29 19:07:21 +00:00
|
|
|
indicators = strategy.populate_indicators(result, metadata)
|
2018-01-15 08:35:11 +00:00
|
|
|
assert type(indicators) is DataFrame
|
2018-07-29 19:07:21 +00:00
|
|
|
assert type(strategy.populate_buy_trend(indicators, metadata)) is DataFrame
|
|
|
|
assert type(strategy.populate_sell_trend(indicators, metadata)) is DataFrame
|