diff options
Diffstat (limited to 'ledger_process.py')
-rw-r--r-- | ledger_process.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ledger_process.py b/ledger_process.py index 7703e58..d5592a2 100644 --- a/ledger_process.py +++ b/ledger_process.py @@ -58,14 +58,14 @@ class LedgerProcess: elif action.type == "withdrawal" and action.asset != "EUR": assert len(actions) == 1 - logger.error("Don't know how do handle withdrawals yet.") - # currency = action.asset - # fifo_queues.setdefault(currency, FIFOQueue()) - # amount = Decimal(action.amount) - # price = 0 # Deposits typically have no associated cost basis - # current = fifo_queues[currency] - - # current.add(amount, price, action.date) + + currency = action.asset + self.external_wallet.setdefault(currency, FIFOQueue()) + self.fifo_queues.setdefault(currency, FIFOQueue()) + + t = self.fifo_queues[currency].remove(lambda t: t.amount == -action.amount + action.fee) + t.remove_coins(action.fee) + self.external_wallet[currency].add_trade(t) def _process_trade(self, refid: str, trades: List[LedgerAction]): if len(trades) == 2: # Ensure we have two related rows (EUR + crypto) |