Rename futures test data
This commit is contained in:
parent
47b50a8a29
commit
4ea8962ca2
@ -1451,9 +1451,9 @@ def test_start_list_data(testdatadir, capsys):
|
|||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
|
|
||||||
assert "Found 5 pair / timeframe combinations." in captured.out
|
assert "Found 5 pair / timeframe combinations." in captured.out
|
||||||
assert "\n| Pair | Timeframe | Type |\n" in captured.out
|
assert "\n| Pair | Timeframe | Type |\n" in captured.out
|
||||||
assert "\n| XRP/USDT | 1h | futures |\n" in captured.out
|
assert "\n| XRP/USDT:USDT | 1h | futures |\n" in captured.out
|
||||||
assert "\n| XRP/USDT | 1h, 8h | mark |\n" in captured.out
|
assert "\n| XRP/USDT:USDT | 1h, 8h | mark |\n" in captured.out
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"list-data",
|
"list-data",
|
||||||
|
@ -294,8 +294,8 @@ def test_convert_trades_format(default_conf, testdatadir, tmpdir):
|
|||||||
|
|
||||||
@pytest.mark.parametrize('file_base,candletype', [
|
@pytest.mark.parametrize('file_base,candletype', [
|
||||||
(['XRP_ETH-5m', 'XRP_ETH-1m'], CandleType.SPOT),
|
(['XRP_ETH-5m', 'XRP_ETH-1m'], CandleType.SPOT),
|
||||||
(['UNITTEST_USDT-1h-mark', 'XRP_USDT-1h-mark'], CandleType.MARK),
|
(['UNITTEST_USDT_USDT-1h-mark', 'XRP_USDT_USDT-1h-mark'], CandleType.MARK),
|
||||||
(['XRP_USDT-1h-futures'], CandleType.FUTURES),
|
(['XRP_USDT_USDT-1h-futures'], CandleType.FUTURES),
|
||||||
])
|
])
|
||||||
def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base, candletype):
|
def test_convert_ohlcv_format(default_conf, testdatadir, tmpdir, file_base, candletype):
|
||||||
tmpdir1 = Path(tmpdir)
|
tmpdir1 = Path(tmpdir)
|
||||||
|
@ -33,10 +33,10 @@ def test_datahandler_ohlcv_get_pairs(testdatadir):
|
|||||||
assert set(pairs) == {'UNITTEST/BTC'}
|
assert set(pairs) == {'UNITTEST/BTC'}
|
||||||
|
|
||||||
pairs = JsonDataHandler.ohlcv_get_pairs(testdatadir, '1h', candle_type=CandleType.MARK)
|
pairs = JsonDataHandler.ohlcv_get_pairs(testdatadir, '1h', candle_type=CandleType.MARK)
|
||||||
assert set(pairs) == {'UNITTEST/USDT', 'XRP/USDT'}
|
assert set(pairs) == {'UNITTEST/USDT:USDT', 'XRP/USDT:USDT'}
|
||||||
|
|
||||||
pairs = JsonGzDataHandler.ohlcv_get_pairs(testdatadir, '1h', candle_type=CandleType.FUTURES)
|
pairs = JsonGzDataHandler.ohlcv_get_pairs(testdatadir, '1h', candle_type=CandleType.FUTURES)
|
||||||
assert set(pairs) == {'XRP/USDT'}
|
assert set(pairs) == {'XRP/USDT:USDT'}
|
||||||
|
|
||||||
pairs = HDF5DataHandler.ohlcv_get_pairs(testdatadir, '1h', candle_type=CandleType.MARK)
|
pairs = HDF5DataHandler.ohlcv_get_pairs(testdatadir, '1h', candle_type=CandleType.MARK)
|
||||||
assert set(pairs) == {'UNITTEST/USDT:USDT'}
|
assert set(pairs) == {'UNITTEST/USDT:USDT'}
|
||||||
@ -104,11 +104,11 @@ def test_datahandler_ohlcv_get_available_data(testdatadir):
|
|||||||
paircombs = JsonDataHandler.ohlcv_get_available_data(testdatadir, TradingMode.FUTURES)
|
paircombs = JsonDataHandler.ohlcv_get_available_data(testdatadir, TradingMode.FUTURES)
|
||||||
# Convert to set to avoid failures due to sorting
|
# Convert to set to avoid failures due to sorting
|
||||||
assert set(paircombs) == {
|
assert set(paircombs) == {
|
||||||
('UNITTEST/USDT', '1h', 'mark'),
|
('UNITTEST/USDT:USDT', '1h', 'mark'),
|
||||||
('XRP/USDT', '1h', 'futures'),
|
('XRP/USDT:USDT', '1h', 'futures'),
|
||||||
('XRP/USDT', '1h', 'mark'),
|
('XRP/USDT:USDT', '1h', 'mark'),
|
||||||
('XRP/USDT', '8h', 'mark'),
|
('XRP/USDT:USDT', '8h', 'mark'),
|
||||||
('XRP/USDT', '8h', 'funding_rate'),
|
('XRP/USDT:USDT', '8h', 'funding_rate'),
|
||||||
}
|
}
|
||||||
|
|
||||||
paircombs = JsonGzDataHandler.ohlcv_get_available_data(testdatadir, TradingMode.SPOT)
|
paircombs = JsonGzDataHandler.ohlcv_get_available_data(testdatadir, TradingMode.SPOT)
|
||||||
|
@ -1460,7 +1460,7 @@ def test_backtest_start_futures_noliq(default_conf_usdt, mocker,
|
|||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
|
|
||||||
mocker.patch('freqtrade.plugins.pairlistmanager.PairListManager.whitelist',
|
mocker.patch('freqtrade.plugins.pairlistmanager.PairListManager.whitelist',
|
||||||
PropertyMock(return_value=['HULUMULU/USDT', 'XRP/USDT']))
|
PropertyMock(return_value=['HULUMULU/USDT', 'XRP/USDT:USDT']))
|
||||||
# mocker.patch('freqtrade.optimize.backtesting.Backtesting.backtest', backtestmock)
|
# mocker.patch('freqtrade.optimize.backtesting.Backtesting.backtest', backtestmock)
|
||||||
|
|
||||||
patched_configuration_load_config_file(mocker, default_conf_usdt)
|
patched_configuration_load_config_file(mocker, default_conf_usdt)
|
||||||
@ -1491,7 +1491,7 @@ def test_backtest_start_nomock_futures(default_conf_usdt, mocker,
|
|||||||
"strategy": CURRENT_TEST_STRATEGY,
|
"strategy": CURRENT_TEST_STRATEGY,
|
||||||
})
|
})
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
result1 = pd.DataFrame({'pair': ['XRP/USDT', 'XRP/USDT'],
|
result1 = pd.DataFrame({'pair': ['XRP/USDT:USDT', 'XRP/USDT:USDT'],
|
||||||
'profit_ratio': [0.0, 0.0],
|
'profit_ratio': [0.0, 0.0],
|
||||||
'profit_abs': [0.0, 0.0],
|
'profit_abs': [0.0, 0.0],
|
||||||
'open_date': pd.to_datetime(['2021-11-18 18:00:00',
|
'open_date': pd.to_datetime(['2021-11-18 18:00:00',
|
||||||
@ -1507,7 +1507,7 @@ def test_backtest_start_nomock_futures(default_conf_usdt, mocker,
|
|||||||
'close_rate': [0.104969, 0.103541],
|
'close_rate': [0.104969, 0.103541],
|
||||||
'exit_reason': [ExitType.ROI, ExitType.ROI]
|
'exit_reason': [ExitType.ROI, ExitType.ROI]
|
||||||
})
|
})
|
||||||
result2 = pd.DataFrame({'pair': ['XRP/USDT', 'XRP/USDT', 'XRP/USDT'],
|
result2 = pd.DataFrame({'pair': ['XRP/USDT:USDT', 'XRP/USDT:USDT', 'XRP/USDT:USDT'],
|
||||||
'profit_ratio': [0.03, 0.01, 0.1],
|
'profit_ratio': [0.03, 0.01, 0.1],
|
||||||
'profit_abs': [0.01, 0.02, 0.2],
|
'profit_abs': [0.01, 0.02, 0.2],
|
||||||
'open_date': pd.to_datetime(['2021-11-19 18:00:00',
|
'open_date': pd.to_datetime(['2021-11-19 18:00:00',
|
||||||
@ -1552,7 +1552,7 @@ def test_backtest_start_nomock_futures(default_conf_usdt, mocker,
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
mocker.patch('freqtrade.plugins.pairlistmanager.PairListManager.whitelist',
|
mocker.patch('freqtrade.plugins.pairlistmanager.PairListManager.whitelist',
|
||||||
PropertyMock(return_value=['XRP/USDT']))
|
PropertyMock(return_value=['XRP/USDT:USDT']))
|
||||||
mocker.patch('freqtrade.optimize.backtesting.Backtesting.backtest', backtestmock)
|
mocker.patch('freqtrade.optimize.backtesting.Backtesting.backtest', backtestmock)
|
||||||
|
|
||||||
patched_configuration_load_config_file(mocker, default_conf_usdt)
|
patched_configuration_load_config_file(mocker, default_conf_usdt)
|
||||||
@ -1575,8 +1575,8 @@ def test_backtest_start_nomock_futures(default_conf_usdt, mocker,
|
|||||||
'up to 2021-11-21 04:00:00 (4 days).',
|
'up to 2021-11-21 04:00:00 (4 days).',
|
||||||
'Backtesting with data from 2021-11-17 21:00:00 '
|
'Backtesting with data from 2021-11-17 21:00:00 '
|
||||||
'up to 2021-11-21 04:00:00 (3 days).',
|
'up to 2021-11-21 04:00:00 (3 days).',
|
||||||
'XRP/USDT, funding_rate, 8h, data starts at 2021-11-18 00:00:00',
|
'XRP/USDT:USDT, funding_rate, 8h, data starts at 2021-11-18 00:00:00',
|
||||||
'XRP/USDT, mark, 8h, data starts at 2021-11-18 00:00:00',
|
'XRP/USDT:USDT, mark, 8h, data starts at 2021-11-18 00:00:00',
|
||||||
f'Running backtesting for Strategy {CURRENT_TEST_STRATEGY}',
|
f'Running backtesting for Strategy {CURRENT_TEST_STRATEGY}',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1553,13 +1553,13 @@ def test_list_available_pairs(botclient):
|
|||||||
client, f"{BASE_URI}/available_pairs?timeframe=1h")
|
client, f"{BASE_URI}/available_pairs?timeframe=1h")
|
||||||
assert_response(rc)
|
assert_response(rc)
|
||||||
assert rc.json()['length'] == 1
|
assert rc.json()['length'] == 1
|
||||||
assert rc.json()['pairs'] == ['XRP/USDT']
|
assert rc.json()['pairs'] == ['XRP/USDT:USDT']
|
||||||
|
|
||||||
rc = client_get(
|
rc = client_get(
|
||||||
client, f"{BASE_URI}/available_pairs?timeframe=1h&candletype=mark")
|
client, f"{BASE_URI}/available_pairs?timeframe=1h&candletype=mark")
|
||||||
assert_response(rc)
|
assert_response(rc)
|
||||||
assert rc.json()['length'] == 2
|
assert rc.json()['length'] == 2
|
||||||
assert rc.json()['pairs'] == ['UNITTEST/USDT', 'XRP/USDT']
|
assert rc.json()['pairs'] == ['UNITTEST/USDT:USDT', 'XRP/USDT:USDT']
|
||||||
assert len(rc.json()['pair_interval']) == 2
|
assert len(rc.json()['pair_interval']) == 2
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user