parent
de727645ab
commit
c5ab3a80a5
@ -171,6 +171,10 @@ class Order(_DECL_BASE):
|
|||||||
"""
|
"""
|
||||||
Get all non-closed orders - useful when trying to batch-update orders
|
Get all non-closed orders - useful when trying to batch-update orders
|
||||||
"""
|
"""
|
||||||
|
if not isinstance(order, dict):
|
||||||
|
logger.warning(f"{order} is not a valid response object.")
|
||||||
|
return
|
||||||
|
|
||||||
filtered_orders = [o for o in orders if o.order_id == order.get('id')]
|
filtered_orders = [o for o in orders if o.order_id == order.get('id')]
|
||||||
if filtered_orders:
|
if filtered_orders:
|
||||||
oobj = filtered_orders[0]
|
oobj = filtered_orders[0]
|
||||||
|
@ -1074,7 +1074,7 @@ def test_get_best_pair(fee):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_persistence")
|
@pytest.mark.usefixtures("init_persistence")
|
||||||
def test_update_order_from_ccxt():
|
def test_update_order_from_ccxt(caplog):
|
||||||
# Most basic order return (only has orderid)
|
# Most basic order return (only has orderid)
|
||||||
o = Order.parse_from_ccxt_object({'id': '1234'}, 'ETH/BTC', 'buy')
|
o = Order.parse_from_ccxt_object({'id': '1234'}, 'ETH/BTC', 'buy')
|
||||||
assert isinstance(o, Order)
|
assert isinstance(o, Order)
|
||||||
@ -1120,6 +1120,14 @@ def test_update_order_from_ccxt():
|
|||||||
with pytest.raises(DependencyException, match=r"Order-id's don't match"):
|
with pytest.raises(DependencyException, match=r"Order-id's don't match"):
|
||||||
o.update_from_ccxt_object(ccxt_order)
|
o.update_from_ccxt_object(ccxt_order)
|
||||||
|
|
||||||
|
message = "aaaa is not a valid response object."
|
||||||
|
assert not log_has(message, caplog)
|
||||||
|
Order.update_orders([o], 'aaaa')
|
||||||
|
assert log_has(message, caplog)
|
||||||
|
|
||||||
|
# Call regular update - shouldn't fail.
|
||||||
|
Order.update_orders([o], {'id': '1234'})
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_persistence")
|
@pytest.mark.usefixtures("init_persistence")
|
||||||
def test_select_order(fee):
|
def test_select_order(fee):
|
||||||
|
Loading…
Reference in New Issue
Block a user