From 1d63a294e8412147b28278114790fbcb910dbb36 Mon Sep 17 00:00:00 2001 From: Joshua Hoogstraat <34964599+jhoogstraat@users.noreply.github.com> Date: Wed, 18 May 2022 13:40:39 +0200 Subject: [PATCH] add deposit when buying with fiat --- src/book.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/book.py b/src/book.py index dd3b535..2974fe3 100644 --- a/src/book.py +++ b/src/book.py @@ -413,6 +413,18 @@ def _read_coinbase(self, file_path: Path) -> None: # If it's a buy, add the corresponding sell to complement # the trading pair. elif operation == "Buy": + # If coins were bought with fiat, first add a corresponding deposit + if misc.is_fiat(_currency_spot): + eur_total = misc.force_decimal(_eur_total) + self.append_operation( + "Deposit", + utc_time, + platform, + eur_total, + _currency_spot, + row, + file_path, + ) assert isinstance(eur_subtotal, decimal.Decimal) self.append_operation( "Sell", @@ -435,7 +447,7 @@ def _read_coinbase_v2(self, file_path: Path) -> None: self._read_coinbase(file_path=file_path) def _read_coinbase_pro(self, file_path: Path) -> None: - platform = "coinbase_pro" + platform = "coinbase" operation_mapping = { "BUY": "Buy", "SELL": "Sell",