Update converter tests
This commit is contained in:
parent
a58c2c4f6c
commit
5a3b907132
@ -1374,7 +1374,7 @@ def test_start_list_data(testdatadir, capsys):
|
||||
|
||||
assert "Found 3 pair / timeframe combinations." in captured.out
|
||||
assert "\n| Pair | Timeframe | Type |\n" in captured.out
|
||||
assert "\n| XRP/USDT | 1h | |\n" in captured.out
|
||||
assert "\n| XRP/USDT | 1h | futures |\n" in captured.out
|
||||
assert "\n| XRP/USDT | 1h | mark |\n" in captured.out
|
||||
|
||||
|
||||
|
@ -12,6 +12,7 @@ from freqtrade.data.converter import (convert_ohlcv_format, convert_trades_forma
|
||||
trades_to_ohlcv, trim_dataframe)
|
||||
from freqtrade.data.history import (get_timerange, load_data, load_pair_history,
|
||||
validate_backtest_data)
|
||||
from freqtrade.data.history.idatahandler import IDataHandler
|
||||
from freqtrade.enums import CandleType
|
||||
from tests.conftest import log_has, log_has_re
|
||||
from tests.data.test_history import _clean_test_file
|
||||
@ -135,7 +136,8 @@ def test_ohlcv_fill_up_missing_data2(caplog):
|
||||
|
||||
def test_ohlcv_drop_incomplete(caplog):
|
||||
timeframe = '1d'
|
||||
ticks = [[
|
||||
ticks = [
|
||||
[
|
||||
1559750400000, # 2019-06-04
|
||||
8.794e-05, # open
|
||||
8.948e-05, # high
|
||||
@ -289,17 +291,19 @@ def test_convert_trades_format(default_conf, testdatadir, tmpdir):
|
||||
file['new'].unlink()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('file_base', [
|
||||
('XRP_ETH-5m'),
|
||||
('XRP_ETH-1m'),
|
||||
# ('XRP_USDT-1h-mark'), #TODO-lev: Create .gz file
|
||||
@pytest.mark.parametrize('file_base,candletype', [
|
||||
('XRP_ETH-5m', CandleType.SPOT),
|
||||
('XRP_ETH-1m', CandleType.SPOT),
|
||||
('XRP_USDT-1h-mark', CandleType.MARK),
|
||||
('XRP_USDT-1h-futures', CandleType.FUTURES),
|
||||
])
|
||||
def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base):
|
||||
def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base, candletype):
|
||||
tmpdir1 = Path(tmpdir)
|
||||
|
||||
file_orig = testdatadir / f"{file_base}.json"
|
||||
file_temp = tmpdir1 / f"{file_base}.json"
|
||||
file_new = tmpdir1 / f"{file_base}.json.gz"
|
||||
prependix = '' if candletype == CandleType.SPOT else 'futures/'
|
||||
file_orig = testdatadir / f"{prependix}{file_base}.json"
|
||||
file_temp = tmpdir1 / f"{prependix}{file_base}.json"
|
||||
file_new = tmpdir1 / f"{prependix}{file_base}.json.gz"
|
||||
IDataHandler.create_dir_if_needed(file_temp)
|
||||
|
||||
copyfile(file_orig, file_temp)
|
||||
|
||||
@ -314,7 +318,7 @@ def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base):
|
||||
convert_from='json',
|
||||
convert_to='jsongz',
|
||||
erase=False,
|
||||
candle_type=CandleType.SPOT
|
||||
candle_type=candletype
|
||||
)
|
||||
|
||||
assert file_new.exists()
|
||||
@ -328,7 +332,7 @@ def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base):
|
||||
convert_from='jsongz',
|
||||
convert_to='json',
|
||||
erase=True,
|
||||
candle_type=CandleType.SPOT
|
||||
candle_type=candletype
|
||||
)
|
||||
|
||||
assert file_temp.exists()
|
||||
|
@ -743,7 +743,7 @@ def test_datahandler_ohlcv_get_available_data(testdatadir):
|
||||
# Convert to set to avoid failures due to sorting
|
||||
assert set(paircombs) == {
|
||||
('UNITTEST/USDT', '1h', 'mark'),
|
||||
('XRP/USDT', '1h', ''),
|
||||
('XRP/USDT', '1h', 'futures'),
|
||||
('XRP/USDT', '1h', 'mark'),
|
||||
}
|
||||
|
||||
|
@ -1356,7 +1356,7 @@ def test_list_available_pairs(botclient):
|
||||
|
||||
ftbot.config['trading_mode'] = 'futures'
|
||||
rc = client_get(
|
||||
client, f"{BASE_URI}/available_pairs?timeframe=1h")
|
||||
client, f"{BASE_URI}/available_pairs?timeframe=1h&candletype=futures")
|
||||
assert_response(rc)
|
||||
assert rc.json()['length'] == 1
|
||||
assert rc.json()['pairs'] == ['XRP/USDT']
|
||||
|
Loading…
Reference in New Issue
Block a user