freqtrade_origin/freqtrade/tests/test_dataframe.py

33 lines
974 B
Python
Raw Normal View History

2018-01-28 07:38:41 +00:00
# pragma pylint: disable=missing-docstring, C0103
2018-01-28 07:38:41 +00:00
import pandas
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
_pairs = ['ETH/BTC']
def load_dataframe_pair(pairs, strategy):
ld = load_data(None, ticker_interval='5m', pairs=pairs)
assert isinstance(ld, dict)
assert isinstance(pairs[0], str)
dataframe = ld[pairs[0]]
2018-07-20 20:02:17 +00:00
dataframe = strategy.analyze_ticker(dataframe, pairs[0])
return dataframe
def test_dataframe_load():
strategy = StrategyResolver({'strategy': 'DefaultStrategy'}).strategy
dataframe = load_dataframe_pair(_pairs, strategy)
assert isinstance(dataframe, pandas.core.frame.DataFrame)
def test_dataframe_columns_exists():
strategy = StrategyResolver({'strategy': 'DefaultStrategy'}).strategy
dataframe = load_dataframe_pair(_pairs, strategy)
assert 'high' in dataframe.columns
assert 'low' in dataframe.columns
assert 'close' in dataframe.columns