Add explicit test for order_to_ccxt
This commit is contained in:
parent
5e18e51ce0
commit
56a73575a1
@ -130,7 +130,7 @@ class Order(_DECL_BASE):
|
||||
'side': self.ft_order_side,
|
||||
'filled': self.filled,
|
||||
'remaining': self.remaining,
|
||||
'datetime': self.order_date_utc.strftime('%Y-%m-%dT%H:%M:%S.%3f'),
|
||||
'datetime': self.order_date_utc.strftime('%Y-%m-%dT%H:%M:%S.%f'),
|
||||
'timestamp': int(self.order_date_utc.timestamp() * 1000),
|
||||
'status': self.status,
|
||||
'fee': None,
|
||||
|
@ -1616,6 +1616,7 @@ def limit_buy_order_open():
|
||||
'datetime': arrow.utcnow().isoformat(),
|
||||
'price': 0.00001099,
|
||||
'amount': 90.99181073,
|
||||
'average': None,
|
||||
'filled': 0.0,
|
||||
'cost': 0.0009999,
|
||||
'remaining': 90.99181073,
|
||||
|
@ -2671,3 +2671,21 @@ def test_select_filled_orders(fee):
|
||||
orders = trades[4].select_filled_orders('sell')
|
||||
assert orders is not None
|
||||
assert len(orders) == 0
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("init_persistence")
|
||||
def test_order_to_ccxt(limit_buy_order_open):
|
||||
|
||||
order = Order.parse_from_ccxt_object(limit_buy_order_open, 'mocked', 'buy')
|
||||
order.query.session.add(order)
|
||||
Order.query.session.commit()
|
||||
|
||||
order_resp = Order.order_by_id(limit_buy_order_open['id'])
|
||||
assert order_resp
|
||||
|
||||
raw_order = order_resp.to_ccxt_object()
|
||||
del raw_order['fee']
|
||||
del raw_order['datetime']
|
||||
del raw_order['info']
|
||||
del limit_buy_order_open['datetime']
|
||||
assert raw_order == limit_buy_order_open
|
||||
|
Loading…
Reference in New Issue
Block a user