return self.__add__(other)
def __sub__(self, other):
+ if other == 0:
+ return self
if other.currency != self.currency and other.value * self.value != 0:
raise Exception("Summing amounts must be done with same currencies")
return Amount(self.currency, self.value - other.value)
"margin_lending_fees",
"margin_borrowed_base_price"
]:
- setattr(self, key, Amount(base_currency, hash_[key]))
+ setattr(self, key, Amount(base_currency, hash_.get(key, 0)))
@classmethod
def in_currency(cls, other_currency, market, compute_value="average", type="total"):