Support having no Amount/Price available from the exchange initially

This commit is contained in:
Matthias 2023-01-08 13:55:09 +01:00
parent fd694f14c2
commit 305b067e48
1 changed files with 6 additions and 2 deletions

View File

@ -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