Merge branch 'develop' into feat/short

This commit is contained in:
Matthias
2021-09-02 07:03:14 +02:00
59 changed files with 562 additions and 275 deletions

View File

@@ -879,7 +879,7 @@ def test_api_status(botclient, mocker, ticker, fee, markets):
'open_trade_value': 15.1668225,
'sell_reason': None,
'sell_order_status': None,
'strategy': 'DefaultStrategy',
'strategy': 'StrategyTestV2',
'buy_tag': None,
'timeframe': 5,
'exchange': 'binance',
@@ -984,7 +984,7 @@ def test_api_forcebuy(botclient, mocker, fee):
close_rate=0.265441,
id=22,
timeframe=5,
strategy="DefaultStrategy"
strategy="StrategyTestV2"
))
mocker.patch("freqtrade.rpc.RPC._rpc_forcebuy", fbuy_mock)
@@ -1034,7 +1034,7 @@ def test_api_forcebuy(botclient, mocker, fee):
'open_trade_value': 0.24605460,
'sell_reason': None,
'sell_order_status': None,
'strategy': 'DefaultStrategy',
'strategy': 'StrategyTestV2',
'buy_tag': None,
'timeframe': 5,
'exchange': 'binance',
@@ -1101,7 +1101,7 @@ def test_api_pair_candles(botclient, ohlcv_history):
f"{BASE_URI}/pair_candles?limit={amount}&pair=XRP%2FBTC&timeframe={timeframe}")
assert_response(rc)
assert 'strategy' in rc.json()
assert rc.json()['strategy'] == 'DefaultStrategy'
assert rc.json()['strategy'] == 'StrategyTestV2'
assert 'columns' in rc.json()
assert 'data_start_ts' in rc.json()
assert 'data_start' in rc.json()
@@ -1139,19 +1139,19 @@ def test_api_pair_history(botclient, ohlcv_history):
# No pair
rc = client_get(client,
f"{BASE_URI}/pair_history?timeframe={timeframe}"
"&timerange=20180111-20180112&strategy=DefaultStrategy")
"&timerange=20180111-20180112&strategy=StrategyTestV2")
assert_response(rc, 422)
# No Timeframe
rc = client_get(client,
f"{BASE_URI}/pair_history?pair=UNITTEST%2FBTC"
"&timerange=20180111-20180112&strategy=DefaultStrategy")
"&timerange=20180111-20180112&strategy=StrategyTestV2")
assert_response(rc, 422)
# No timerange
rc = client_get(client,
f"{BASE_URI}/pair_history?pair=UNITTEST%2FBTC&timeframe={timeframe}"
"&strategy=DefaultStrategy")
"&strategy=StrategyTestV2")
assert_response(rc, 422)
# No strategy
@@ -1163,14 +1163,14 @@ def test_api_pair_history(botclient, ohlcv_history):
# Working
rc = client_get(client,
f"{BASE_URI}/pair_history?pair=UNITTEST%2FBTC&timeframe={timeframe}"
"&timerange=20180111-20180112&strategy=DefaultStrategy")
"&timerange=20180111-20180112&strategy=StrategyTestV2")
assert_response(rc, 200)
assert rc.json()['length'] == 289
assert len(rc.json()['data']) == rc.json()['length']
assert 'columns' in rc.json()
assert 'data' in rc.json()
assert rc.json()['pair'] == 'UNITTEST/BTC'
assert rc.json()['strategy'] == 'DefaultStrategy'
assert rc.json()['strategy'] == 'StrategyTestV2'
assert rc.json()['data_start'] == '2018-01-11 00:00:00+00:00'
assert rc.json()['data_start_ts'] == 1515628800000
assert rc.json()['data_stop'] == '2018-01-12 00:00:00+00:00'
@@ -1179,7 +1179,7 @@ def test_api_pair_history(botclient, ohlcv_history):
# No data found
rc = client_get(client,
f"{BASE_URI}/pair_history?pair=UNITTEST%2FBTC&timeframe={timeframe}"
"&timerange=20200111-20200112&strategy=DefaultStrategy")
"&timerange=20200111-20200112&strategy=StrategyTestV2")
assert_response(rc, 502)
assert rc.json()['error'] == ("Error querying /api/v1/pair_history: "
"No data for UNITTEST/BTC, 5m in 20200111-20200112 found.")
@@ -1217,21 +1217,21 @@ def test_api_strategies(botclient):
assert_response(rc)
assert rc.json() == {'strategies': [
'DefaultStrategy',
'HyperoptableStrategy',
'TestStrategyLegacy'
'StrategyTestV2',
'TestStrategyLegacyV1'
]}
def test_api_strategy(botclient):
ftbot, client = botclient
rc = client_get(client, f"{BASE_URI}/strategy/DefaultStrategy")
rc = client_get(client, f"{BASE_URI}/strategy/StrategyTestV2")
assert_response(rc)
assert rc.json()['strategy'] == 'DefaultStrategy'
assert rc.json()['strategy'] == 'StrategyTestV2'
data = (Path(__file__).parents[1] / "strategy/strats/default_strategy.py").read_text()
data = (Path(__file__).parents[1] / "strategy/strats/strategy_test_v2.py").read_text()
assert rc.json()['code'] == data
rc = client_get(client, f"{BASE_URI}/strategy/NoStrat")
@@ -1288,7 +1288,7 @@ def test_api_backtesting(botclient, mocker, fee, caplog):
# start backtesting
data = {
"strategy": "DefaultStrategy",
"strategy": "StrategyTestV2",
"timeframe": "5m",
"timerange": "20180110-20180111",
"max_open_trades": 3,

View File

@@ -1236,7 +1236,7 @@ def test_show_config_handle(default_conf, update, mocker) -> None:
assert msg_mock.call_count == 1
assert '*Mode:* `{}`'.format('Dry-run') in msg_mock.call_args_list[0][0][0]
assert '*Exchange:* `binance`' in msg_mock.call_args_list[0][0][0]
assert '*Strategy:* `DefaultStrategy`' in msg_mock.call_args_list[0][0][0]
assert '*Strategy:* `StrategyTestV2`' in msg_mock.call_args_list[0][0][0]
assert '*Stoploss:* `-0.1`' in msg_mock.call_args_list[0][0][0]
msg_mock.reset_mock()
@@ -1245,7 +1245,7 @@ def test_show_config_handle(default_conf, update, mocker) -> None:
assert msg_mock.call_count == 1
assert '*Mode:* `{}`'.format('Dry-run') in msg_mock.call_args_list[0][0][0]
assert '*Exchange:* `binance`' in msg_mock.call_args_list[0][0][0]
assert '*Strategy:* `DefaultStrategy`' in msg_mock.call_args_list[0][0][0]
assert '*Strategy:* `StrategyTestV2`' in msg_mock.call_args_list[0][0][0]
assert '*Initial Stoploss:* `-0.1`' in msg_mock.call_args_list[0][0][0]