def deposit(self, asset: Asset, amount: FVal, time: Timestamp) -> None: self.increase_asset(asset, amount) # and also add it to the ledgers entry = { 'refid': self.next_ledger_id(), 'time': str(time) + '.0000', 'type': 'deposit', # 'aclass': 'notusedbyrotkehlchen', 'asset': asset.to_kraken(), 'amount': str(amount), 'fee': '0', # 'balance': 'notusedbyrotkehlchen', } self.deposits_ledger.append(entry)
def decrease_asset(self, asset: Asset, amount: FVal) -> None: kraken_asset = asset.to_kraken() assert kraken_asset in self.balances_dict, 'Asset should exist in funds' msg = 'We should have enough funds to decrease asset' assert amount <= self.balances_dict[kraken_asset], msg self.balances_dict[kraken_asset] -= amount
def get_balance(self, asset: Asset) -> Optional[FVal]: """Returns the balance of asset that's held in the exchance or None""" kasset = asset.to_kraken() return self.balances_dict.get(kasset)
def increase_asset(self, asset: Asset, amount: FVal) -> None: kraken_asset = asset.to_kraken() if kraken_asset not in self.balances_dict: self.balances_dict[kraken_asset] = amount else: self.balances_dict[kraken_asset] += amount