Improve test resiliance by properly setting Order object

This commit is contained in:
Matthias 2022-09-03 08:16:33 +02:00
parent b26126cb57
commit 966de19611
2 changed files with 4 additions and 0 deletions

View File

@ -37,6 +37,7 @@ def generate_mock_trade(pair: str, fee: float, is_open: bool,
trade.orders.append(Order( trade.orders.append(Order(
ft_order_side=trade.entry_side, ft_order_side=trade.entry_side,
order_id=f'{pair}-{trade.entry_side}-{trade.open_date}', order_id=f'{pair}-{trade.entry_side}-{trade.open_date}',
ft_is_open=False,
ft_pair=pair, ft_pair=pair,
amount=trade.amount, amount=trade.amount,
filled=trade.amount, filled=trade.amount,
@ -51,6 +52,7 @@ def generate_mock_trade(pair: str, fee: float, is_open: bool,
trade.orders.append(Order( trade.orders.append(Order(
ft_order_side=trade.exit_side, ft_order_side=trade.exit_side,
order_id=f'{pair}-{trade.exit_side}-{trade.close_date}', order_id=f'{pair}-{trade.exit_side}-{trade.close_date}',
ft_is_open=False,
ft_pair=pair, ft_pair=pair,
amount=trade.amount, amount=trade.amount,
filled=trade.amount, filled=trade.amount,

View File

@ -654,6 +654,7 @@ def test_trade_close(fee):
trade.orders.append(Order( trade.orders.append(Order(
ft_order_side=trade.entry_side, ft_order_side=trade.entry_side,
order_id=f'{trade.pair}-{trade.entry_side}-{trade.open_date}', order_id=f'{trade.pair}-{trade.entry_side}-{trade.open_date}',
ft_is_open=False,
ft_pair=trade.pair, ft_pair=trade.pair,
amount=trade.amount, amount=trade.amount,
filled=trade.amount, filled=trade.amount,
@ -667,6 +668,7 @@ def test_trade_close(fee):
trade.orders.append(Order( trade.orders.append(Order(
ft_order_side=trade.exit_side, ft_order_side=trade.exit_side,
order_id=f'{trade.pair}-{trade.exit_side}-{trade.open_date}', order_id=f'{trade.pair}-{trade.exit_side}-{trade.open_date}',
ft_is_open=False,
ft_pair=trade.pair, ft_pair=trade.pair,
amount=trade.amount, amount=trade.amount,
filled=trade.amount, filled=trade.amount,