fix first important tests in test_freqtradebot, update and fix on order related Trade class hybrid_properties

This commit is contained in:
axel
2023-06-15 01:55:13 -04:00
parent 450fc5763f
commit 9cdff0b0a5
4 changed files with 79 additions and 39 deletions

View File

@@ -2592,7 +2592,6 @@ def open_trade():
pair='ETH/BTC',
open_rate=0.00001099,
exchange='binance',
open_order_id='123456789',
amount=90.99181073,
fee_open=0.0,
fee_close=0.0,
@@ -2604,7 +2603,7 @@ def open_trade():
Order(
ft_order_side='buy',
ft_pair=trade.pair,
ft_is_open=False,
ft_is_open=True,
ft_amount=trade.amount,
ft_price=trade.open_rate,
order_id='123456789',

View File

@@ -3143,7 +3143,8 @@ def test_manage_open_orders_partial(
open_trade.is_short = is_short
open_trade.leverage = leverage
open_trade.orders[0].ft_order_side = 'sell' if is_short else 'buy'
limit_buy_order_old_partial['id'] = open_trade.open_order_id
# limit_buy_order_old_partial['id'] = open_trade.open_order_id
limit_buy_order_old_partial['id'] = open_trade.orders[0].order_id
limit_buy_order_old_partial['side'] = 'sell' if is_short else 'buy'
limit_buy_canceled = deepcopy(limit_buy_order_old_partial)
limit_buy_canceled['status'] = 'canceled'
@@ -3167,7 +3168,8 @@ 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_order_id.is_(open_trade.open_order_id))).all()
select(Trade).filter(Trade.open_orders_count != 0)
).all()
assert len(trades) == 1
assert trades[0].amount == 23.0
assert trades[0].stake_amount == open_trade.open_rate * trades[0].amount / leverage