2018-01-28 07:38:41 +00:00
|
|
|
# pragma pylint: disable=missing-docstring, C0103
|
2017-12-28 14:58:02 +00:00
|
|
|
|
2018-01-28 07:38:41 +00:00
|
|
|
import pandas
|
2018-03-15 22:37:34 +00:00
|
|
|
|
2018-03-17 21:44:47 +00:00
|
|
|
from freqtrade.optimize import load_data
|
2018-03-24 17:11:21 +00:00
|
|
|
from freqtrade.strategy.resolver import StrategyResolver
|
2017-12-28 14:58:02 +00:00
|
|
|
|
2018-02-03 16:15:40 +00:00
|
|
|
_pairs = ['ETH/BTC']
|
2017-12-28 14:58:02 +00:00
|
|
|
|
2017-12-28 19:05:33 +00:00
|
|
|
|
2018-07-09 16:27:36 +00:00
|
|
|
def load_dataframe_pair(pairs, strategy):
|
2018-03-24 09:21:59 +00:00
|
|
|
ld = load_data(None, ticker_interval='5m', pairs=pairs)
|
2017-12-28 14:58:02 +00:00
|
|
|
assert isinstance(ld, dict)
|
|
|
|
assert isinstance(pairs[0], str)
|
|
|
|
dataframe = ld[pairs[0]]
|
2018-03-02 13:46:32 +00:00
|
|
|
|
2018-07-16 05:11:17 +00:00
|
|
|
dataframe = strategy.analyze_ticker(dataframe)
|
2017-12-28 14:58:02 +00:00
|
|
|
return dataframe
|
|
|
|
|
2017-12-28 19:05:33 +00:00
|
|
|
|
2017-12-28 14:58:02 +00:00
|
|
|
def test_dataframe_load():
|
2018-07-09 16:27:36 +00:00
|
|
|
strategy = StrategyResolver({'strategy': 'DefaultStrategy'}).strategy
|
|
|
|
dataframe = load_dataframe_pair(_pairs, strategy)
|
2017-12-28 14:58:02 +00:00
|
|
|
assert isinstance(dataframe, pandas.core.frame.DataFrame)
|
|
|
|
|
2017-12-28 19:05:33 +00:00
|
|
|
|
2017-12-28 14:58:02 +00:00
|
|
|
def test_dataframe_columns_exists():
|
2018-07-09 16:27:36 +00:00
|
|
|
strategy = StrategyResolver({'strategy': 'DefaultStrategy'}).strategy
|
|
|
|
dataframe = load_dataframe_pair(_pairs, strategy)
|
2017-12-28 19:05:33 +00:00
|
|
|
assert 'high' in dataframe.columns
|
|
|
|
assert 'low' in dataframe.columns
|
2017-12-28 14:58:02 +00:00
|
|
|
assert 'close' in dataframe.columns
|