From 031157e5aab5ec52478c866e902c48b91cde3abe Mon Sep 17 00:00:00 2001 From: Timotheus Pokorra Date: Wed, 12 May 2021 07:34:55 +0200 Subject: [PATCH] fix fees when importing from bitcoin.de --- apps/transactions/importbtcde.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/transactions/importbtcde.py b/apps/transactions/importbtcde.py index d246176..2c7bef0 100644 --- a/apps/transactions/importbtcde.py +++ b/apps/transactions/importbtcde.py @@ -37,7 +37,10 @@ class ImportBtcDe: if trade['trading_pair'].upper().endswith(f): t.fiat_currency = f t.owner = Owner - t.crypto_amount = Decimal(trade['amount_currency_to_trade'])-Decimal(trade['amount_currency_to_trade']) + if trade['type'] == 'sell': + t.crypto_amount = Decimal(trade['amount_currency_to_trade'])-Decimal(trade['fee_currency_to_trade']) + else: + t.crypto_amount = Decimal(trade['amount_currency_to_trade']) t.crypto_fee = Decimal(trade['fee_currency_to_trade']) t.fiat_amount = Decimal(trade['volume_currency_to_pay']) t.fiat_fee = Decimal(trade['fee_currency_to_pay']) @@ -45,6 +48,7 @@ class ImportBtcDe: t.transaction_type = 'S' else: t.transaction_type = 'B' + t.description = 'Bitcoin.de Trade' t.exchange_rate = trade['price'] t.date_valid = trade['created_at'] t.save()