mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Improve test to cover to_ccxt better
This commit is contained in:
parent
6a271317bc
commit
1e9fa4c041
|
@ -2481,7 +2481,7 @@ def test_select_filled_orders(fee):
|
|||
|
||||
|
||||
@pytest.mark.usefixtures("init_persistence")
|
||||
def test_order_to_ccxt(limit_buy_order_open):
|
||||
def test_order_to_ccxt(limit_buy_order_open, limit_sell_order_usdt_open):
|
||||
|
||||
order = Order.parse_from_ccxt_object(limit_buy_order_open, 'mocked', 'buy')
|
||||
order.ft_trade_id = 1
|
||||
|
@ -2495,11 +2495,23 @@ def test_order_to_ccxt(limit_buy_order_open):
|
|||
del raw_order['fee']
|
||||
del raw_order['datetime']
|
||||
del raw_order['info']
|
||||
assert raw_order['stopPrice'] is None
|
||||
del raw_order['stopPrice']
|
||||
assert raw_order.get('stopPrice') is None
|
||||
raw_order.pop('stopPrice', None)
|
||||
del limit_buy_order_open['datetime']
|
||||
assert raw_order == limit_buy_order_open
|
||||
|
||||
order1 = Order.parse_from_ccxt_object(limit_sell_order_usdt_open, 'mocked', 'sell')
|
||||
order1.ft_order_side = 'stoploss'
|
||||
order1.stop_price = order1.price * 0.9
|
||||
order1.ft_trade_id = 1
|
||||
order1.session.add(order1)
|
||||
Order.session.commit()
|
||||
|
||||
order_resp1 = Order.order_by_id(limit_sell_order_usdt_open['id'])
|
||||
raw_order1 = order_resp1.to_ccxt_object()
|
||||
|
||||
assert raw_order1.get('stopPrice') is not None
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("init_persistence")
|
||||
@pytest.mark.parametrize('data', [
|
||||
|
|
Loading…
Reference in New Issue
Block a user