mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Improve test for dry-run orderclosing
This commit is contained in:
parent
6da3fa08e4
commit
fe8083c7f8
|
@ -1200,7 +1200,7 @@ def test_migrate_new(mocker, default_conf, fee, caplog):
|
||||||
0.00258580, {stake}, {amount},
|
0.00258580, {stake}, {amount},
|
||||||
'2019-11-28 12:44:24.000000',
|
'2019-11-28 12:44:24.000000',
|
||||||
0.0, 0.0, 0.0, '5m',
|
0.0, 0.0, 0.0, '5m',
|
||||||
'buy_order', 'stop_order_id222')
|
'buy_order', 'dry_stop_order_id222')
|
||||||
""".format(fee=fee.return_value,
|
""".format(fee=fee.return_value,
|
||||||
stake=default_conf.get("stake_amount"),
|
stake=default_conf.get("stake_amount"),
|
||||||
amount=amount
|
amount=amount
|
||||||
|
@ -1226,7 +1226,7 @@ def test_migrate_new(mocker, default_conf, fee, caplog):
|
||||||
'buy',
|
'buy',
|
||||||
'ETC/BTC',
|
'ETC/BTC',
|
||||||
0,
|
0,
|
||||||
'buy_order',
|
'dry_buy_order',
|
||||||
'closed',
|
'closed',
|
||||||
'ETC/BTC',
|
'ETC/BTC',
|
||||||
'limit',
|
'limit',
|
||||||
|
@ -1236,14 +1236,46 @@ def test_migrate_new(mocker, default_conf, fee, caplog):
|
||||||
{amount},
|
{amount},
|
||||||
0,
|
0,
|
||||||
{amount * 0.00258580}
|
{amount * 0.00258580}
|
||||||
|
),
|
||||||
|
(
|
||||||
|
1,
|
||||||
|
'buy',
|
||||||
|
'ETC/BTC',
|
||||||
|
1,
|
||||||
|
'dry_buy_order22',
|
||||||
|
'canceled',
|
||||||
|
'ETC/BTC',
|
||||||
|
'limit',
|
||||||
|
'buy',
|
||||||
|
0.00258580,
|
||||||
|
{amount},
|
||||||
|
{amount},
|
||||||
|
0,
|
||||||
|
{amount * 0.00258580}
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
1,
|
1,
|
||||||
'stoploss',
|
'stoploss',
|
||||||
'ETC/BTC',
|
'ETC/BTC',
|
||||||
|
1,
|
||||||
|
'dry_stop_order_id11X',
|
||||||
|
'canceled',
|
||||||
|
'ETC/BTC',
|
||||||
|
'limit',
|
||||||
|
'sell',
|
||||||
|
0.00258580,
|
||||||
|
{amount},
|
||||||
|
{amount},
|
||||||
0,
|
0,
|
||||||
'stop_order_id222',
|
{amount * 0.00258580}
|
||||||
'closed',
|
),
|
||||||
|
(
|
||||||
|
1,
|
||||||
|
'stoploss',
|
||||||
|
'ETC/BTC',
|
||||||
|
1,
|
||||||
|
'dry_stop_order_id222',
|
||||||
|
'open',
|
||||||
'ETC/BTC',
|
'ETC/BTC',
|
||||||
'limit',
|
'limit',
|
||||||
'sell',
|
'sell',
|
||||||
|
@ -1292,7 +1324,7 @@ def test_migrate_new(mocker, default_conf, fee, caplog):
|
||||||
assert trade.exit_reason is None
|
assert trade.exit_reason is None
|
||||||
assert trade.strategy is None
|
assert trade.strategy is None
|
||||||
assert trade.timeframe == '5m'
|
assert trade.timeframe == '5m'
|
||||||
assert trade.stoploss_order_id == 'stop_order_id222'
|
assert trade.stoploss_order_id == 'dry_stop_order_id222'
|
||||||
assert trade.stoploss_last_update is None
|
assert trade.stoploss_last_update is None
|
||||||
assert log_has("trying trades_bak1", caplog)
|
assert log_has("trying trades_bak1", caplog)
|
||||||
assert log_has("trying trades_bak2", caplog)
|
assert log_has("trying trades_bak2", caplog)
|
||||||
|
@ -1302,12 +1334,21 @@ def test_migrate_new(mocker, default_conf, fee, caplog):
|
||||||
assert trade.close_profit_abs is None
|
assert trade.close_profit_abs is None
|
||||||
|
|
||||||
orders = trade.orders
|
orders = trade.orders
|
||||||
assert len(orders) == 2
|
assert len(orders) == 4
|
||||||
assert orders[0].order_id == 'buy_order'
|
assert orders[0].order_id == 'dry_buy_order'
|
||||||
assert orders[0].ft_order_side == 'buy'
|
assert orders[0].ft_order_side == 'buy'
|
||||||
|
|
||||||
assert orders[1].order_id == 'stop_order_id222'
|
assert orders[-1].order_id == 'dry_stop_order_id222'
|
||||||
assert orders[1].ft_order_side == 'stoploss'
|
assert orders[-1].ft_order_side == 'stoploss'
|
||||||
|
assert orders[-1].ft_is_open is True
|
||||||
|
|
||||||
|
assert orders[1].order_id == 'dry_buy_order22'
|
||||||
|
assert orders[1].ft_order_side == 'buy'
|
||||||
|
assert orders[1].ft_is_open is False
|
||||||
|
|
||||||
|
assert orders[2].order_id == 'dry_stop_order_id11X'
|
||||||
|
assert orders[2].ft_order_side == 'stoploss'
|
||||||
|
assert orders[2].ft_is_open is False
|
||||||
|
|
||||||
|
|
||||||
def test_migrate_too_old(mocker, default_conf, fee, caplog):
|
def test_migrate_too_old(mocker, default_conf, fee, caplog):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user