Don't raise OperationalException when orderid's dont' match

This commit is contained in:
Matthias 2020-09-06 14:33:45 +02:00
parent a78d61150c
commit 68d51a9787
2 changed files with 9 additions and 5 deletions

View File

@ -17,7 +17,7 @@ from sqlalchemy.orm.session import sessionmaker
from sqlalchemy.pool import StaticPool
from sqlalchemy.sql.schema import UniqueConstraint
from freqtrade.exceptions import OperationalException
from freqtrade.exceptions import DependencyException, OperationalException
from freqtrade.misc import safe_value_fallback
from freqtrade.persistence.migrations import check_migrate
@ -140,7 +140,7 @@ class Order(_DECL_BASE):
Only updates if fields are available from ccxt -
"""
if self.order_id != str(order['id']):
return OperationalException("Order-id's don't match")
raise DependencyException("Order-id's don't match")
self.status = order.get('status', self.status)
self.symbol = order.get('symbol', self.symbol)

View File

@ -7,9 +7,9 @@ import pytest
from sqlalchemy import create_engine
from freqtrade import constants
from freqtrade.exceptions import OperationalException
from freqtrade.persistence import Trade, Order, clean_dry_run_db, init
from tests.conftest import log_has, create_mock_trades
from freqtrade.exceptions import DependencyException, OperationalException
from freqtrade.persistence import Order, Trade, clean_dry_run_db, init
from tests.conftest import create_mock_trades, log_has
def test_init_create_session(default_conf):
@ -1074,3 +1074,7 @@ def test_update_order_from_ccxt():
assert o.remaining == 0.0
assert not o.ft_is_open
assert o.order_filled_date is not None
ccxt_order.update({'id': 'somethingelse'})
with pytest.raises(DependencyException, match=r"Order-id's don't match"):
o.update_from_ccxt_object(ccxt_order)