2018-01-15 08:35:11 +00:00
|
|
|
import json
|
2018-03-17 21:44:47 +00:00
|
|
|
|
2018-01-15 08:35:11 +00:00
|
|
|
import pytest
|
|
|
|
from pandas import DataFrame
|
2018-03-17 21:44:47 +00:00
|
|
|
|
2018-07-10 10:04:37 +00:00
|
|
|
from freqtrade.analyze import parse_ticker_dataframe
|
2018-03-24 19:44:04 +00:00
|
|
|
from freqtrade.strategy.default_strategy import DefaultStrategy
|
2018-01-15 08:35:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def result():
|
2018-05-02 20:49:55 +00:00
|
|
|
with open('freqtrade/tests/testdata/ETH_BTC-1m.json') as data_file:
|
2018-07-10 10:04:37 +00:00
|
|
|
return parse_ticker_dataframe(json.load(data_file))
|
2018-01-15 08:35:11 +00:00
|
|
|
|
2018-01-18 05:50:12 +00:00
|
|
|
|
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):
|
|
|
|
strategy = DefaultStrategy()
|
|
|
|
|
|
|
|
assert type(strategy.minimal_roi) is dict
|
|
|
|
assert type(strategy.stoploss) is float
|
2018-03-26 14:04:04 +00:00
|
|
|
assert type(strategy.ticker_interval) is str
|
2018-01-15 08:35:11 +00:00
|
|
|
indicators = strategy.populate_indicators(result)
|
|
|
|
assert type(indicators) is DataFrame
|
|
|
|
assert type(strategy.populate_buy_trend(indicators)) is DataFrame
|
|
|
|
assert type(strategy.populate_sell_trend(indicators)) is DataFrame
|