From 305b067e4859e3a7e200afa15aa5f40537ea69d6 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 8 Jan 2023 13:55:09 +0100 Subject: [PATCH] Support having no Amount/Price available from the exchange initially --- freqtrade/persistence/trade_model.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/freqtrade/persistence/trade_model.py b/freqtrade/persistence/trade_model.py index b6871c04a..3013df2b8 100644 --- a/freqtrade/persistence/trade_model.py +++ b/freqtrade/persistence/trade_model.py @@ -84,9 +84,13 @@ class Order(_DECL_BASE): self.order_filled_date.replace(tzinfo=timezone.utc) if self.order_filled_date else None ) + @property + def safe_amount(self) -> float: + return self.amount or self.ft_amount + @property def safe_price(self) -> float: - return self.average or self.price or self.stop_price + return self.average or self.price or self.stop_price or self.ft_price @property def safe_filled(self) -> float: @@ -96,7 +100,7 @@ class Order(_DECL_BASE): def safe_remaining(self) -> float: return ( self.remaining if self.remaining is not None else - self.amount - (self.filled or 0.0) + self.safe_amount - (self.filled or 0.0) ) @property