Cleanup unused property

This commit is contained in:
Matthias
2023-09-08 19:51:14 +02:00
parent 43bb4114d0
commit 830fc7580c
3 changed files with 9 additions and 12 deletions

View File

@@ -505,10 +505,6 @@ class LocalTrade:
]
return len(open_orders_wo_sl) > 0
@property
def open_orders_count(self) -> int:
return len(self.open_orders)
@property
def open_entry_or_exit_orders_count(self) -> int:
@@ -519,7 +515,7 @@ class LocalTrade:
return len(open_buy_or_sell_orders)
@property
def open_orders_ids(self) -> list:
def open_orders_ids(self) -> List[str]:
open_orders_ids_wo_sl = [
oo.order_id for oo in self.open_orders
if oo.ft_order_side not in ['stoploss']

View File

@@ -458,14 +458,14 @@ def test_update_limit_order(fee, caplog, limit_buy_order_usdt, limit_sell_order_
leverage=lev,
trading_mode=trading_mode
)
assert trade.open_orders_count == 0
assert not trade.has_open_orders
assert trade.close_profit is None
assert trade.close_date is None
oobj = Order.parse_from_ccxt_object(enter_order, 'ADA/USDT', entry_side)
trade.orders.append(oobj)
trade.update_trade(oobj)
assert trade.open_orders_count == 0
assert not trade.has_open_orders
assert trade.open_rate == open_rate
assert trade.close_profit is None
assert trade.close_date is None
@@ -481,7 +481,7 @@ def test_update_limit_order(fee, caplog, limit_buy_order_usdt, limit_sell_order_
trade.orders.append(oobj)
trade.update_trade(oobj)
assert trade.open_orders_count == 0
assert not trade.has_open_orders
assert trade.close_rate == close_rate
assert pytest.approx(trade.close_profit) == profit
assert trade.close_date is not None

View File

@@ -872,7 +872,7 @@ def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
trade.is_short = is_short
assert trade
assert trade.is_open is True
assert trade.open_orders_count > 0
assert trade.has_open_orders
assert '22' in trade.open_orders_ids
# Test calling with price
@@ -899,7 +899,7 @@ def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
trade = Trade.session.scalars(select(Trade)).all()[2]
trade.is_short = is_short
assert trade
assert trade.open_orders_count == 0
assert not trade.has_open_orders
assert trade.open_rate == 10
assert trade.stake_amount == round(order['average'] * order['filled'] / leverage, 8)
assert pytest.approx(trade.liquidation_price) == liq_price
@@ -917,7 +917,7 @@ def test_execute_entry(mocker, default_conf_usdt, fee, limit_order,
trade = Trade.session.scalars(select(Trade)).all()[3]
trade.is_short = is_short
assert trade
assert trade.open_orders_count == 0
assert not trade.has_open_orders
assert trade.open_rate == 0.5
assert trade.stake_amount == round(order['average'] * order['filled'] / leverage, 8)
@@ -3184,12 +3184,13 @@ def test_manage_open_orders_partial(
assert cancel_order_mock.call_count == 1
assert rpc_mock.call_count == 3
trades = Trade.session.scalars(
select(Trade).filter(Trade.open_orders_count != 0)
select(Trade)
).all()
assert len(trades) == 1
assert trades[0].amount == 23.0
assert trades[0].stake_amount == open_trade.open_rate * trades[0].amount / leverage
assert trades[0].stake_amount != prior_stake
assert not trades[0].has_open_orders
@pytest.mark.parametrize("is_short", [False, True])