Read funding_fee on order objects in "from_json"
This commit is contained in:
@@ -1817,6 +1817,7 @@ class Trade(ModelBase, LocalTrade):
|
|||||||
price=order["price"],
|
price=order["price"],
|
||||||
ft_price=order["price"],
|
ft_price=order["price"],
|
||||||
remaining=order["remaining"],
|
remaining=order["remaining"],
|
||||||
|
funding_fee=order.get("funding_fee", None),
|
||||||
)
|
)
|
||||||
trade.orders.append(order_obj)
|
trade.orders.append(order_obj)
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,8 @@ def test_trade_fromjson():
|
|||||||
"order_filled_date": "2022-10-18 09:45:22",
|
"order_filled_date": "2022-10-18 09:45:22",
|
||||||
"order_type": "market",
|
"order_type": "market",
|
||||||
"price": 0.2592,
|
"price": 0.2592,
|
||||||
"remaining": 0.0
|
"remaining": 0.0,
|
||||||
|
"funding_fee": -0.055
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}"""
|
}"""
|
||||||
@@ -192,3 +193,4 @@ def test_trade_fromjson():
|
|||||||
last_o = trade.orders[-1]
|
last_o = trade.orders[-1]
|
||||||
assert last_o.order_filled_utc == datetime(2022, 10, 18, 9, 45, 22, tzinfo=timezone.utc)
|
assert last_o.order_filled_utc == datetime(2022, 10, 18, 9, 45, 22, tzinfo=timezone.utc)
|
||||||
assert isinstance(last_o.order_date, datetime)
|
assert isinstance(last_o.order_date, datetime)
|
||||||
|
assert last_o.funding_fee == -0.055
|
||||||
|
|||||||
Reference in New Issue
Block a user