Fix filled exception

closes #5404
This commit is contained in:
Matthias 2021-08-12 05:02:36 +00:00 committed by GitHub
parent bfc3968ab3
commit e03784d98d
2 changed files with 6 additions and 1 deletions

View File

@ -161,7 +161,7 @@ class Order(_DECL_BASE):
self.ft_is_open = True
if self.status in ('closed', 'canceled', 'cancelled'):
self.ft_is_open = False
if order.get('filled', 0) > 0:
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)

View File

@ -1224,6 +1224,11 @@ def test_update_order_from_ccxt(caplog):
assert o.ft_is_open
assert o.order_filled_date is None
# Order is unfilled, "filled" not set
# https://github.com/freqtrade/freqtrade/issues/5404
ccxt_order.update({'filled': None, 'remaining': 20.0, 'status': 'canceled'})
o.update_from_ccxt_object(ccxt_order)
# Order has been closed
ccxt_order.update({'filled': 20.0, 'remaining': 0.0, 'status': 'closed'})
o.update_from_ccxt_object(ccxt_order)