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-02 15:22:00 +00:00
|
|
|
from freqtrade.analyze import Analyze
|
2018-03-17 21:44:47 +00:00
|
|
|
from freqtrade.optimize import load_data
|
2018-03-15 22:37:34 +00:00
|
|
|
from freqtrade.strategy.strategy import Strategy
|
2017-12-28 14:58:02 +00:00
|
|
|
|
|
|
|
_pairs = ['BTC_ETH']
|
|
|
|
|
2017-12-28 19:05:33 +00:00
|
|
|
|
2017-12-28 14:58:02 +00:00
|
|
|
def load_dataframe_pair(pairs):
|
2018-03-02 13:46:32 +00:00
|
|
|
ld = load_data(None, ticker_interval=5, 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
|
|
|
|
|
|
|
analyze = Analyze({'strategy': 'default_strategy'})
|
2017-12-28 14:58:02 +00:00
|
|
|
dataframe = analyze.analyze_ticker(dataframe)
|
|
|
|
return dataframe
|
|
|
|
|
2017-12-28 19:05:33 +00:00
|
|
|
|
2017-12-28 14:58:02 +00:00
|
|
|
def test_dataframe_load():
|
2018-03-15 22:37:34 +00:00
|
|
|
Strategy({'strategy': 'default_strategy'})
|
2017-12-28 14:58:02 +00:00
|
|
|
dataframe = load_dataframe_pair(_pairs)
|
|
|
|
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-03-15 22:37:34 +00:00
|
|
|
Strategy({'strategy': 'default_strategy'})
|
2017-12-28 14:58:02 +00:00
|
|
|
dataframe = load_dataframe_pair(_pairs)
|
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
|