|
|
|
|
@ -1870,11 +1870,13 @@ def test_get_exit_order_count(fee, is_short):
|
|
|
|
|
@pytest.mark.usefixtures("init_persistence")
|
|
|
|
|
def test_update_order_from_ccxt(caplog):
|
|
|
|
|
# Most basic order return (only has orderid)
|
|
|
|
|
o = Order.parse_from_ccxt_object({'id': '1234'}, 'ADA/USDT', 'buy')
|
|
|
|
|
o = Order.parse_from_ccxt_object({'id': '1234'}, 'ADA/USDT', 'buy', 20.01, 1234.6)
|
|
|
|
|
assert isinstance(o, Order)
|
|
|
|
|
assert o.ft_pair == 'ADA/USDT'
|
|
|
|
|
assert o.ft_order_side == 'buy'
|
|
|
|
|
assert o.order_id == '1234'
|
|
|
|
|
assert o.ft_price == 1234.6
|
|
|
|
|
assert o.ft_amount == 20.01
|
|
|
|
|
assert o.ft_is_open
|
|
|
|
|
ccxt_order = {
|
|
|
|
|
'id': '1234',
|
|
|
|
|
@ -1888,13 +1890,15 @@ def test_update_order_from_ccxt(caplog):
|
|
|
|
|
'status': 'open',
|
|
|
|
|
'timestamp': 1599394315123
|
|
|
|
|
}
|
|
|
|
|
o = Order.parse_from_ccxt_object(ccxt_order, 'ADA/USDT', 'buy')
|
|
|
|
|
o = Order.parse_from_ccxt_object(ccxt_order, 'ADA/USDT', 'buy', 20.01, 1234.6)
|
|
|
|
|
assert isinstance(o, Order)
|
|
|
|
|
assert o.ft_pair == 'ADA/USDT'
|
|
|
|
|
assert o.ft_order_side == 'buy'
|
|
|
|
|
assert o.order_id == '1234'
|
|
|
|
|
assert o.order_type == 'limit'
|
|
|
|
|
assert o.price == 1234.5
|
|
|
|
|
assert o.ft_price == 1234.6
|
|
|
|
|
assert o.ft_amount == 20.01
|
|
|
|
|
assert o.filled == 9
|
|
|
|
|
assert o.remaining == 11
|
|
|
|
|
assert o.order_date is not None
|
|
|
|
|
@ -2539,6 +2543,8 @@ def test_recalc_trade_from_orders_dca(data) -> None:
|
|
|
|
|
ft_pair=trade.pair,
|
|
|
|
|
order_id=f"order_{order[0]}_{idx}",
|
|
|
|
|
ft_is_open=False,
|
|
|
|
|
ft_amount=amount,
|
|
|
|
|
ft_price=price,
|
|
|
|
|
status="closed",
|
|
|
|
|
symbol=trade.pair,
|
|
|
|
|
order_type="market",
|
|
|
|
|
|