self.free = Amount(currency, free_value)
self.used = Amount(currency, used_value)
+ @classmethod
+ def from_hash(cls, currency, hash_):
+ return cls(currency, hash_["total"], hash_["free"], hash_["used"])
+
@classmethod
def in_currency(cls, other_currency, market, action="average", type="total"):
amounts = {}
def currencies(cls):
return cls.known_balances.keys()
- @classmethod
- def from_hash(cls, currency, hash_):
- return cls(currency, hash_["total"], hash_["free"], hash_["used"])
-
@classmethod
def _fill_balances(cls, hash_):
for key in hash_:
new_repartition = cls.dispatch_assets(total_base_value)
Trade.compute_trades(values_in_base, new_repartition, market=market)
- def __int__(self):
- return int(self.total)
-
def __repr__(self):
return "Balance({} [{}/{}/{}])".format(self.currency, str(self.free), str(self.used), str(self.total))