Update failing test

This commit is contained in:
Matthias 2022-02-20 14:27:26 +01:00
parent db540dc990
commit dc7bcf5dda
4 changed files with 8 additions and 4 deletions

View File

@ -1415,7 +1415,8 @@ class FreqtradeBot(LoggingMixin):
return real_amount
return amount
def handle_order_fee(self, trade: Trade, order_obj: Order, order: Dict[str, Any]) -> Dict[str, Any]:
def handle_order_fee(
self, trade: Trade, order_obj: Order, order: Dict[str, Any]) -> Dict[str, Any]:
# Try update amount (binance-fix)
try:
new_amount = self.get_real_amount(trade, order)

View File

@ -187,7 +187,6 @@ class Order(_DECL_BASE):
if (order.get('filled', 0.0) or 0.0) > 0:
self.order_filled_date = datetime.now(timezone.utc)
self.order_update_date = datetime.now(timezone.utc)
return self
def to_json(self) -> Dict[str, Any]:
return {

View File

@ -1738,7 +1738,6 @@ def test_update_trade_state_withorderdict(default_conf_usdt, trades_for_order, l
assert not log_has_re(log_text, caplog)
def test_update_trade_state_exception(mocker, default_conf_usdt,
limit_buy_order_usdt, caplog) -> None:
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)

View File

@ -4,6 +4,7 @@ import pytest
from freqtrade.enums import SellType
from freqtrade.persistence import Trade
from freqtrade.persistence.models import Order
from freqtrade.rpc.rpc import RPC
from freqtrade.strategy.interface import SellCheckTuple
from tests.conftest import get_patched_freqtradebot, patch_get_signal
@ -94,7 +95,11 @@ def test_may_execute_exit_stoploss_on_exchange_multi(default_conf, ticker, fee,
trades = Trade.query.all()
# Make sure stoploss-order is open and trade is bought (since we mock update_trade_state)
for trade in trades:
trade.stoploss_order_id = 3
stoploss_order_closed['id'] = '3'
oobj = Order.parse_from_ccxt_object(stoploss_order_closed, trade.pair, 'stoploss')
trade.orders.append(oobj)
trade.stoploss_order_id = '3'
trade.open_order_id = None
n = freqtrade.exit_positions(trades)