Read funding_fee on order objects in "from_json"

This commit is contained in:
Matthias
2023-10-07 08:43:06 +02:00
parent 910e317a45
commit 178c0972ff
2 changed files with 4 additions and 1 deletions

View File

@@ -1817,6 +1817,7 @@ class Trade(ModelBase, LocalTrade):
price=order["price"],
ft_price=order["price"],
remaining=order["remaining"],
funding_fee=order.get("funding_fee", None),
)
trade.orders.append(order_obj)

View File

@@ -170,7 +170,8 @@ def test_trade_fromjson():
"order_filled_date": "2022-10-18 09:45:22",
"order_type": "market",
"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]
assert last_o.order_filled_utc == datetime(2022, 10, 18, 9, 45, 22, tzinfo=timezone.utc)
assert isinstance(last_o.order_date, datetime)
assert last_o.funding_fee == -0.055