2018-01-28 07:38:41 +00:00
|
|
|
# pragma pylint: disable=missing-docstring, C0103
|
2018-12-11 18:48:36 +00:00
|
|
|
import logging
|
2018-02-04 08:28:02 +00:00
|
|
|
|
2018-12-12 19:16:03 +00:00
|
|
|
from freqtrade.data.converter import parse_ticker_dataframe
|
2018-12-11 18:48:36 +00:00
|
|
|
from freqtrade.tests.conftest import log_has
|
2018-02-04 08:28:02 +00:00
|
|
|
|
|
|
|
|
2017-11-07 19:12:56 +00:00
|
|
|
def test_dataframe_correct_length(result):
|
2018-07-10 10:04:37 +00:00
|
|
|
dataframe = parse_ticker_dataframe(result)
|
2018-06-07 09:56:39 +00:00
|
|
|
assert len(result.index) - 1 == len(dataframe.index) # last partial candle removed
|
2017-10-01 08:02:47 +00:00
|
|
|
|
2017-10-30 23:36:35 +00:00
|
|
|
|
2017-11-07 19:12:56 +00:00
|
|
|
def test_dataframe_correct_columns(result):
|
2017-10-01 08:02:47 +00:00
|
|
|
assert result.columns.tolist() == \
|
2018-04-09 17:15:04 +00:00
|
|
|
['date', 'open', 'high', 'low', 'close', 'volume']
|
2017-10-01 08:02:47 +00:00
|
|
|
|
2017-10-30 23:36:35 +00:00
|
|
|
|
2018-12-11 18:48:36 +00:00
|
|
|
def test_parse_ticker_dataframe(ticker_history, caplog):
|
2018-07-16 05:59:14 +00:00
|
|
|
columns = ['date', 'open', 'high', 'low', 'close', 'volume']
|
2018-07-16 05:11:17 +00:00
|
|
|
|
2018-12-11 18:48:36 +00:00
|
|
|
caplog.set_level(logging.DEBUG)
|
2018-07-16 05:59:14 +00:00
|
|
|
# Test file with BV data
|
|
|
|
dataframe = parse_ticker_dataframe(ticker_history)
|
|
|
|
assert dataframe.columns.tolist() == columns
|
2018-12-11 18:48:36 +00:00
|
|
|
assert log_has('Parsing tickerlist to dataframe', caplog.record_tuples)
|